Created
May 10, 2026 15:16
-
-
Save lambdan/10b38de6544b9d9c9fa4df1c6b3dccbd to your computer and use it in GitHub Desktop.
Set up tools in Windows path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Make c:\path | |
| # Add it to $PATH | |
| # Put this script in c:\path and run it :) | |
| # Currently installs ffmpeg/ffprobe/ffplay, yt-dlp | |
| $YTDLP_URL = "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe" | |
| $YTDLP_TARGET = "./yt-dlp.exe" | |
| $FFMPEG_URL = "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip" | |
| $FFMPEG_TARGET_ZIP = "./tmp_ffmpeg.zip" | |
| $FFMPEG_TARGET_EXE = "./ffmpeg.exe" | |
| function DownloadIfNotExists { | |
| param ( | |
| [Parameter(Mandatory)] | |
| [string]$Url, | |
| [Parameter(Mandatory)] | |
| [string]$Target | |
| ) | |
| if (Test-Path $Target) { | |
| Write-Host $Target already exists! | |
| } else { | |
| Write-Host Downloading $Url | |
| # disable progress bar temporarily to speed up download | |
| $ProgressPreference = 'SilentlyContinue' | |
| Invoke-WebRequest $Url -OutFile tmp_download | |
| move tmp_download $Target | |
| $ProgressPreference = 'Continue' # restore progress bar | |
| } | |
| } | |
| # yt-dlp | |
| DownloadIfNotExists $YTDLP_URL $YTDLP_TARGET | |
| # ffmpeg | |
| if (Test-Path $FFMPEG_TARGET_EXE) { | |
| Write-Host $FFMPEG_TARGET_EXE "already exists" | |
| } else { | |
| DownloadIfNotExists $FFMPEG_URL $FFMPEG_TARGET_ZIP | |
| Expand-Archive $FFMPEG_TARGET_ZIP -DestinationPath ./tmp_ffmpeg | |
| move ./tmp_ffmpeg/*/bin/* . | |
| remove-item ./tmp_ffmpeg -recurse | |
| remove-item $FFMPEG_TARGET_ZIP | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment