40 lines
1.1 KiB
PowerShell
40 lines
1.1 KiB
PowerShell
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
|
|
function pressEnterToExit {
|
|
Write-Host "Press Enter to exit... " -NoNewline
|
|
[void][System.Console]::ReadLine()
|
|
}
|
|
|
|
$installPath = Join-Path $HOME "programs\convert"
|
|
New-Item -Force -ItemType Directory $installPath | Out-Null
|
|
|
|
$executablePath = Join-Path $installPath convert.exe
|
|
go build -o $executablePath
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "✅ built: $executablePath"
|
|
} else {
|
|
Write-Host "❌ build error"
|
|
pressEnterToExit
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
reg add "HKCU\Software\Classes\SystemFileAssociations\.mp4\shell\convert" /ve /d "convert" /f > $null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "❌ reg error"
|
|
pressEnterToExit
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
$command = $executablePath + " -i `"%1`""
|
|
reg add "HKCU\Software\Classes\SystemFileAssociations\.mp4\shell\convert\command" /ve /d $command /f > $null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "❌ reg error"
|
|
pressEnterToExit
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Write-Host "✅ reg values added"
|
|
pressEnterToExit
|