diff --git a/windows/installers/losslesscut.bat b/windows/installers/losslesscut.bat index e12e197..cc075f8 100644 --- a/windows/installers/losslesscut.bat +++ b/windows/installers/losslesscut.bat @@ -1,4 +1,5 @@ @ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION :: Start as administrator fltmc >NUL 2>&1 || ( @@ -8,6 +9,21 @@ fltmc >NUL 2>&1 || ( EXIT 0 ) +:: 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 +) + ECHO LosslessCut... PowerShell -Command "" ^ "$archive = 'LosslessCut-win-x64.7z';" ^ @@ -15,7 +31,7 @@ PowerShell -Command "" ^ "$outfile = Join-Path -Path $env:TEMP -ChildPath $archive;" ^ "Invoke-WebRequest -Uri $link -OutFile $outfile;" ^ "cd $env:TEMP;" ^ - "& $env:ProgramFiles\7-Zip\7z.exe x $archive -o'%ProgramFiles%\LosslessCut' -y;" ^ + "& !extractor! x $archive -o'%ProgramFiles%\LosslessCut' -y;" ^ "$WshShell = New-Object -comObject WScript.Shell;" ^ "$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\LosslessCut.lnk');" ^ "$Shortcut.TargetPath = '%ProgramFiles%\LosslessCut\LosslessCut.exe';" ^