Skip to content

Instantly share code, notes, and snippets.

@gregmac
Last active September 13, 2021 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregmac/f70e3ae3d878c5d9f94f4e3c5d94113c to your computer and use it in GitHub Desktop.
Save gregmac/f70e3ae3d878c5d9f94f4e3c5d94113c to your computer and use it in GitHub Desktop.
<#
Create a Start Menu shortcut for the settings for each camera on the system.
Requires ffmpeg installed via https://scoop.sh/
(or modify to point at the proper ffmpeg.exe location)
#>
$ffmpeg = "`$env:USERPROFILE\scoop\apps\ffmpeg\current\bin\ffmpeg.exe"
Get-PnpDevice -Class Camera | foreach {
Write-Host "Creating shortcut for $($_.FriendlyName)"
$command = "start-Process -filePath $ffmpeg -ArgumentList @('-f dshow -show_video_device_dialog true -i video=`"`"`"$($_.FriendlyName)`"`"`"') -NoNewWindow"
$Shortcut = (New-Object -comObject WScript.Shell).CreateShortcut("$env:AppData\Microsoft\Windows\Start Menu\Programs\$($_.FriendlyName) Settings.lnk")
$Shortcut.TargetPath = "powershell.exe"
$Shortcut.Arguments = "-windowstyle hidden -command `"$($command -replace "`"","`"`"`"")`""
$Shortcut.Save()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment