diff --git a/hazedumper/generate.bat b/hazedumper/generate.bat index 68046fc..68ead0d 100644 --- a/hazedumper/generate.bat +++ b/hazedumper/generate.bat @@ -1,4 +1,5 @@ -@ECHO off +@ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION IF NOT EXIST .\hazedumper.exe ( ECHO Download latest release of hazedumper @@ -14,16 +15,16 @@ IF NOT EXIST .\hazedumper.exe ( :: Unzip the file PowerShell -NoLogo -NoProfile -Command "& { $shell = New-Object -COM" ^ - "Shell.Application; $target = $shell.NameSpace('%CD%'); $zip =" ^ - "$shell.NameSpace('%CD%\%dir%.zip'); $target.CopyHere($zip.Items(), 16); }" ^ - "%dir%" + "Shell.Application; $target = $shell.NameSpace('%CD%'); $zip =" ^ + "$shell.NameSpace('%CD%\!dir!.zip'); $target.CopyHere($zip.Items()," ^ + "16); }" "!dir!" :: Move the binary to the current directory - MOVE .\%dir%\*.exe .\ + MOVE .\!dir!\*.exe .\ :: Delete unnecessary file and directory - DEL %dir%.zip - RMDIR %dir%\ + DEL !dir!.zip + RMDIR !dir!\ ) IF NOT EXIST .\config.json ( diff --git a/run.bat b/run.bat index af34fac..8cf624a 100644 --- a/run.bat +++ b/run.bat @@ -1,11 +1,12 @@ -@ECHO off +@ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION :: Variables SET "pipR=pip install -r .\requirements.txt" SET "py=python.exe" :: Check python installation -%py% --version > NUL +!py! --version > NUL :: Clean potential error or python version CLS @@ -19,19 +20,19 @@ IF ERRORLEVEL 1 ( ECHO Download and installation of dependencies... :: Location of Python - SET "py=%LOCALAPPDATA%\Microsoft\WindowsApps\%py%" + SET "py=%LOCALAPPDATA%\Microsoft\WindowsApps\!py!" :: Update pip - %py% -m pip install --upgrade pip + !py! -m pip install --upgrade pip :: Install dependencies - %py% -m %pipR% + !py! -m !pipR! ) ELSE ( :: Check dependencies - %py% -m %pipR% > NUL + !py! -m !pipR! > NUL ) :: Run app -%py% .\main.py +!py! .\main.py EXIT /b