confOS/windows/installers/losslesscut.bat

45 lines
1.4 KiB
Batchfile
Raw Normal View History

2024-07-02 12:15:42 +02:00
@ECHO OFF
2024-07-02 12:36:34 +02:00
SETLOCAL ENABLEDELAYEDEXPANSION
2024-07-02 12:15:42 +02:00
:: Start as administrator
fltmc >NUL 2>&1 || (
PowerShell Start -Verb RunAs '%0' 2>NUL || (
EXIT 1
)
EXIT 0
)
2024-07-02 12:36:34 +02:00
:: Find .7z extractor
SET "7ZIP=%ProgramFiles%\7-Zip\7z.exe"
SET "NANAZIP=%LOCALAPPDATA%\Microsoft\WindowsApps\NanaZipC.exe"
IF EXIST !7ZIP! (
SET "extractor=!7ZIP!"
)
IF NOT DEFINED extractor IF EXIST !NANAZIP! (
SET "extractor=!NANAZIP!"
)
IF NOT DEFINED extractor (
ECHO No extractor for 7z files found.
EXIT /B 1
)
2024-07-02 12:15:42 +02:00
ECHO LosslessCut...
PowerShell -Command "" ^
"$archive = 'LosslessCut-win-x64.7z';" ^
"$link = 'https://github.com/mifi/lossless-cut/releases/latest/download/' + $archive;" ^
"$outfile = Join-Path -Path $env:TEMP -ChildPath $archive;" ^
"Invoke-WebRequest -Uri $link -OutFile $outfile;" ^
"cd $env:TEMP;" ^
2024-07-02 12:36:34 +02:00
"& !extractor! x $archive -o'%ProgramFiles%\LosslessCut' -y;" ^
2024-07-02 12:15:42 +02:00
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\LosslessCut.lnk');" ^
"$Shortcut.TargetPath = '%ProgramFiles%\LosslessCut\LosslessCut.exe';" ^
"$Shortcut.Save();" ^
"Remove-Item -Force $archive"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\LosslessCut" /f /v DisplayName /t REG_SZ /d "LosslessCut"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\LosslessCut" /f /v InstallLocation /t REG_SZ /d "%ProgramFiles%\LosslessCut"
IF NOT "%1"=="yes" PAUSE
EXIT /B