chcp 65001 # 一键安装 FFMPEG 的 PowerShell 脚本 clear-host $mirrorChoice = Read-Host "是否使用镜像站下载 FFMPEG?(y/n)" if ($mirrorChoice -eq 'y') { $downloadUrl = "https://ff.rryth.com/ff.zip" } else { $downloadUrl = "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip" } $installDir = "C:FFMPEG" $downloadDest = "$installDir fmpeg.zip" # 创建安装目录 if (Test-Path $installDir) { Remove-Item -Recurse -Force $installDir } New-Item -Path $installDir -ItemType Directory | Out-Null # 下载 FFMPEG Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadDest # 解压缩 Expand-Archive -Path $downloadDest -DestinationPath $installDir # 移动 ffmpeg.exe Move-Item -Path "$installDirin fmpeg.exe" -Destination "$installDir fmpeg.exe" # 询问是否添加到环境变量 $addToPath = Read-Host "是否将 FFMPEG 添加到环境变量?(y/n)" if ($addToPath -eq 'y') { $envPath = [System.Environment]::GetEnvironmentVariable("Path", "User") if (-not $envPath.EndsWith(";")) { $envPath += ";" } [System.Environment]::SetEnvironmentVariable("Path", "$envPath$installDir", "User") Write-Host "FFMPEG 已添加到环境变量!" } else { Write-Host "FFMPEG 未添加到环境变量。" } Write-Host "FFMPEG 安装完成!"