never-away/header.bat

30 lines
642 B
Batchfile
Raw Normal View History

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "tmpFile=%TEMP%\~searchBea.py"
CALL :getLine "::python_beg" "::python_end" > "!tmpFile!"
:: Install dependencies
python -m pip install pyautogui >NUL
:: Run the program
PowerShell -Command "Start-Process cmd -Argument '/c START /B python !tmpFile!' -WindowStyle hidden"
EXIT /B
:getLine <beg str> <end str>
SET "bBegEnd=0"
FOR /F "usebackq delims=" %%i IN ("%~f0") do (
IF !bBegEnd! EQU 1 (
IF "%%i" EQU "%~2" ( EXIT /B )
SETLOCAL DISABLEDELAYEDEXPANSION
ECHO %%i
ENDLOCAL
) ELSE (
IF "%%i" EQU "%~1" ( SET "bBegEnd=1" )
)
)
ENDLOCAL
EXIT /B