find extractor

This commit is contained in:
Mylloon 2024-07-02 12:36:34 +02:00
parent b475e7363b
commit 965f8914ac
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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';" ^