Skip to content

Commit 2bf289b

Browse files
committed
Update install-vlc.ps1 and uninstall-vlc.ps1
1 parent 16bb5e7 commit 2bf289b

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Scripts/install-vlc.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@
55
This PowerShell script installs the VLC media player.
66
.EXAMPLE
77
PS> ./install-vlc.ps1
8+
⏳ Installing VLC media player...
9+
✔️ Installation of VLC media player took 25 sec
810
.LINK
911
https://github.com/fleschutz/PowerShell
1012
.NOTES
1113
Author: Markus Fleschutz | License: CC0
1214
#>
1315

1416
try {
15-
"Installing VLC media player, please wait..."
17+
"⏳ Installing VLC media player..."
18+
$StopWatch = [system.diagnostics.stopwatch]::startNew()
1619

17-
& winget install --id VideoLAN.VLC --accept-package-agreements --accept-source-agreements
18-
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
20+
& winget install --id XPDM1ZW6815MQM --accept-package-agreements --accept-source-agreements
21+
if ($lastExitCode -ne "0") { throw "Can't install VLC media player, is it already installed?" }
1922

20-
"VLC media player installed successfully."
23+
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
24+
"✔️ Installation of VLC media player took $Elapsed sec"
2125
exit 0 # success
2226
} catch {
2327
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

Scripts/uninstall-vlc.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@
44
.DESCRIPTION
55
This PowerShell script uninstalls the VLC media player from the local computer.
66
.EXAMPLE
7-
PS> ./uninstall-vlc
7+
PS> ./uninstall-vlc.ps1
8+
⏳ Uninstalling VLC media player...
9+
✔️ Removal of VLC media player took 7 sec
810
.LINK
911
https://github.com/fleschutz/PowerShell
1012
.NOTES
1113
Author: Markus Fleschutz | License: CC0
1214
#>
1315

1416
try {
15-
"Uninstalling VLC media player, please wait..."
17+
"⏳ Uninstalling VLC media player..."
18+
$StopWatch = [system.diagnostics.stopwatch]::startNew()
1619

17-
& winget uninstall "VLC"
20+
& winget uninstall --id XPDM1ZW6815MQM
1821
if ($lastExitCode -ne "0") { throw "Can't uninstall VLC media player, is it installed?" }
1922

20-
"VLC media player is uninstalled now."
23+
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
24+
"✔️ Removal of VLC media player took $Elapsed sec"
2125
exit 0 # success
2226
} catch {
2327
"Sorry: $($Error[0])"

0 commit comments

Comments
 (0)