File tree 2 files changed +16
-8
lines changed
2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 5
5
This PowerShell script installs the VLC media player.
6
6
. EXAMPLE
7
7
PS> ./install-vlc.ps1
8
+ ⏳ Installing VLC media player...
9
+ ✔️ Installation of VLC media player took 25 sec
8
10
. LINK
9
11
https://github.com/fleschutz/PowerShell
10
12
. NOTES
11
13
Author: Markus Fleschutz | License: CC0
12
14
#>
13
15
14
16
try {
15
- " Installing VLC media player, please wait..."
17
+ " ⏳ Installing VLC media player..."
18
+ $StopWatch = [system.diagnostics.stopwatch ]::startNew()
16
19
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? " }
19
22
20
- " VLC media player installed successfully."
23
+ [int ]$Elapsed = $StopWatch.Elapsed.TotalSeconds
24
+ " ✔️ Installation of VLC media player took $Elapsed sec"
21
25
exit 0 # success
22
26
} catch {
23
27
" ⚠️ Error in line $ ( $_.InvocationInfo.ScriptLineNumber ) : $ ( $Error [0 ]) "
Original file line number Diff line number Diff line change 4
4
. DESCRIPTION
5
5
This PowerShell script uninstalls the VLC media player from the local computer.
6
6
. EXAMPLE
7
- PS> ./uninstall-vlc
7
+ PS> ./uninstall-vlc.ps1
8
+ ⏳ Uninstalling VLC media player...
9
+ ✔️ Removal of VLC media player took 7 sec
8
10
. LINK
9
11
https://github.com/fleschutz/PowerShell
10
12
. NOTES
11
13
Author: Markus Fleschutz | License: CC0
12
14
#>
13
15
14
16
try {
15
- " Uninstalling VLC media player, please wait..."
17
+ " ⏳ Uninstalling VLC media player..."
18
+ $StopWatch = [system.diagnostics.stopwatch ]::startNew()
16
19
17
- & winget uninstall " VLC "
20
+ & winget uninstall -- id XPDM1ZW6815MQM
18
21
if ($lastExitCode -ne " 0" ) { throw " Can't uninstall VLC media player, is it installed?" }
19
22
20
- " VLC media player is uninstalled now."
23
+ [int ]$Elapsed = $StopWatch.Elapsed.TotalSeconds
24
+ " ✔️ Removal of VLC media player took $Elapsed sec"
21
25
exit 0 # success
22
26
} catch {
23
27
" Sorry: $ ( $Error [0 ]) "
You can’t perform that action at this time.
0 commit comments