feat: initial CLI converter (v1.2)
This commit is contained in:
commit
02fd1dc817
5 files changed
+284
No files matched your search
+39
@@ -0,0 +1,39 @@
|
||||
[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
|
||||
Reference in new issue
Block a user