PowerShell/docs/install-vlc.md
2025-05-12 22:04:02 +02:00

1.6 KiB

The install-vlc.ps1 Script

This PowerShell script installs the VLC media player.

Parameters

/Repos/PowerShell/scripts/install-vlc.ps1 [<CommonParameters>]

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

Example

PS> ./install-vlc.ps1
 Installing VLC media player from Winget...
 VLC media player installed successfully in 25s.

Notes

Author: Markus Fleschutz | License: CC0

https://github.com/fleschutz/PowerShell

Script Content

<#
.SYNOPSIS
	Installs VLC
.DESCRIPTION
	This PowerShell script installs the VLC media player.
.EXAMPLE
	PS> ./install-vlc.ps1
	⏳ Installing VLC media player from Winget...
	✅ VLC media player installed successfully in 25s.
.LINK
	https://github.com/fleschutz/PowerShell
.NOTES
	Author: Markus Fleschutz | License: CC0
#>

try {
	"⏳ Installing VLC media player from WinGet..."
	$stopWatch = [system.diagnostics.stopwatch]::startNew()

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

	[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
	"✅ VLC media player installed successfully in $($elapsed)s."
	exit 0 # success
} catch {
	"⚠️ Error: $($Error[0])"
	exit 1
}

(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:54)