use delayedexpansion

This commit is contained in:
Mylloon 2023-04-05 12:33:06 +02:00
parent 6bed72ad60
commit d11d47a068
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 16 additions and 14 deletions

View file

@ -1,4 +1,5 @@
@ECHO off @ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
IF NOT EXIST .\hazedumper.exe ( IF NOT EXIST .\hazedumper.exe (
ECHO Download latest release of hazedumper ECHO Download latest release of hazedumper
@ -14,16 +15,16 @@ IF NOT EXIST .\hazedumper.exe (
:: Unzip the file :: Unzip the file
PowerShell -NoLogo -NoProfile -Command "& { $shell = New-Object -COM" ^ PowerShell -NoLogo -NoProfile -Command "& { $shell = New-Object -COM" ^
"Shell.Application; $target = $shell.NameSpace('%CD%'); $zip =" ^ "Shell.Application; $target = $shell.NameSpace('%CD%'); $zip =" ^
"$shell.NameSpace('%CD%\%dir%.zip'); $target.CopyHere($zip.Items(), 16); }" ^ "$shell.NameSpace('%CD%\!dir!.zip'); $target.CopyHere($zip.Items()," ^
"%dir%" "16); }" "!dir!"
:: Move the binary to the current directory :: Move the binary to the current directory
MOVE .\%dir%\*.exe .\ MOVE .\!dir!\*.exe .\
:: Delete unnecessary file and directory :: Delete unnecessary file and directory
DEL %dir%.zip DEL !dir!.zip
RMDIR %dir%\ RMDIR !dir!\
) )
IF NOT EXIST .\config.json ( IF NOT EXIST .\config.json (

15
run.bat
View file

@ -1,11 +1,12 @@
@ECHO off @ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
:: Variables :: Variables
SET "pipR=pip install -r .\requirements.txt" SET "pipR=pip install -r .\requirements.txt"
SET "py=python.exe" SET "py=python.exe"
:: Check python installation :: Check python installation
%py% --version > NUL !py! --version > NUL
:: Clean potential error or python version :: Clean potential error or python version
CLS CLS
@ -19,19 +20,19 @@ IF ERRORLEVEL 1 (
ECHO Download and installation of dependencies... ECHO Download and installation of dependencies...
:: Location of Python :: Location of Python
SET "py=%LOCALAPPDATA%\Microsoft\WindowsApps\%py%" SET "py=%LOCALAPPDATA%\Microsoft\WindowsApps\!py!"
:: Update pip :: Update pip
%py% -m pip install --upgrade pip !py! -m pip install --upgrade pip
:: Install dependencies :: Install dependencies
%py% -m %pipR% !py! -m !pipR!
) ELSE ( ) ELSE (
:: Check dependencies :: Check dependencies
%py% -m %pipR% > NUL !py! -m !pipR! > NUL
) )
:: Run app :: Run app
%py% .\main.py !py! .\main.py
EXIT /b EXIT /b