combin.bat
rem @echo off
cls
set srcdir=%~1
set outdir=%~d1%~p1
set outname=%~n1
set outpath="%outdir%%outname%.txt"
%~d1
cd %srcdir%
del %outpath%
echo outpath: %outpath%
echo load filelist please wait...
for /f "delims=" %%a in ('dir /b') do call :ProcessOne "%srcdir%\%%a"
goto End
:ProcessOne
set curfile=%1
set curname=%~n1%~x1
echo %curfile%
echo file:%curname%>>%outpath%
type %curfile%>>%outpath%
echo.>>%outpath%
echo.>>%outpath%
goto :eof
:End
pause
register.bat
@echo off
cls
set srcdir=%~1
if exist %~1 if not exist %~1\nul goto DoFile
%~d1
cd %srcdir%
echo load filelist please wait...
for /f "delims=" %%a in ('dir /b') do call :ProcessOne "%srcdir%\%%a"
goto End
:ProcessOne
set curfile=%1
regsvr32 %curfile% /s
if '%errorlevel%' NEQ '0' goto fail
:pass
echo reg-pass %curfile%
goto :eof
:fail
echo reg-fail %curfile%
goto :eof
:DoFile
call :ProcessOne %~1
goto End
:End
pause
testevent.bat
chcp 936
@echo off
set infile="%~1"
cls
if %infile% EQU "" (
goto :ShowCfg
)
echo InputFile: %infile%
for /f "delims=" %%i in ('findstr "Event" %%infile%%') do (
set %%i 2>NUL
)
set etype=%Event :~1,-1%
echo Type: %etype%
set barcode=(none)
for /f "delims=" %%i in ('findstr "B1.Barcode =" %%infile%%') do (
set %%i 2>NUL
set B1.Barcode=%B1.Barcode %
)
for /f "delims=" %%i in ('findstr "LastBarcode =" %%infile%%') do (
set %%i 2>NUL
set LastBarcode=%LastBarcode %
)
if defined B1.Barcode (
set barcode=%B1.Barcode:~1,-1%
)
if defined LastBarcode (
set barcode=%LastBarcode:~1,-1%
)
echo barcode: %barcode%
for /f "delims=" %%i in ('findstr "FileName" %%infile%%') do (
set %%i 2>NUL
)
set eFile=%FileName :~1,-1%
for /f "delims=" %%i in ('findstr "BoardName" %%infile%%') do (
set %%i 2>NUL
)
set eBoard=%BoardName :~1,-1%
for /f "delims=" %%i in ('find "Result = " %%infile%%') do (
set %%i 2>NUL
)
set retfile=%Result :~1,-1%
set retfile="%retfile:\\=\%"
echo ResultFile: %retfile%
if %etype% EQU Barcode (
goto :Barcode
)
if %etype% EQU TestStart (
goto :TestStart
)
if %etype% EQU TestDone (
echo 测试完成事件, 可自定义动作, bat无处理
call :writeresult_ok
goto :PEnd
)
if %etype% EQU TestResult (
echo 测试结果事件, 可做上传等动作, bat无处理
call :writeresult_ok
goto :PEnd
)
if %etype% EQU FileLoad (
echo 文件载入事件
echo 载入文件为: %eFile%
echo 载入文件编号为: %eBoard%
call :writeresult_ok
goto :PEnd
)
if %etype% EQU FileChange (
echo 文件修改事件, bat无处理
call :writeresult_ok
goto :PEnd
)
echo 其他事件, 不处理
call :writeresult_ok
goto :PEnd
:ShowCfg
echo 界面可现实程序的参数设置!
goto :PEnd
:Barcode
echo 输入条码事件, 可检查条码, bat例子检查条码是否是全数字
echo 是全数字检查通过并更新条码
echo 是a-c字母检查通过并提示信息
echo 条码不是全数字作为检查失败
call :checkbarcode
if %ret% equ 1 (
echo 条码是全数字, 检查通过
call :writeresult_setbc
goto :PEnd
)
call :checkbarcodeAC
if %ret% equ 1 (
echo 条码是a-c, 检查通过
call :writeresult_info
goto :PEnd
)
echo 条码不是全数字, 检查失败!
call :writeresult_barcode
goto :PEnd
:TestStart
echo 测试开始事件, 可检查条码, bat例子检查条码是否是全数字
call :checkbarcode
if %ret% equ 1 (
echo 条码是全数字, 检查通过
call :writeresult_ok
goto :PEnd
)
if %ret% equ 0 (
echo 条码不是全数字, 检查失败!
call :writeresult_barcode
goto :PEnd
)
goto :End
:checkbarcode
echo %barcode%|findstr /v "[^0-9]" && set ret=1 || set ret=0
goto :eof
:checkbarcodeAC
echo %barcode%|findstr /v "[^a-c]" && set ret=1 || set ret=0
goto :eof
:writeresult_ok
echo TestCancel ^= ^0>%retfile%
echo InfoText ^= >>%retfile%
goto :eof
:writeresult_setbc
echo TestCancel ^= ^1>%retfile%
echo InfoText ^= >>%retfile%
echo Action\0000 ^= ;cmd=barcode;type=input;b1=33334444;>>%retfile%
echo Action\0001 ^= ;cmd=barcode;type=input;b2=77778888;>>%retfile%
goto :eof
:writeresult_info
echo TestCancel ^= ^0>%retfile%
echo InfoText ^= a-c barcode is>>%retfile%
goto :eof
:writeresult_barcode
echo TestCancel ^= ^1>%retfile%
echo InfoText ^= 条码检查, 条码不是全数字, 检查失败!>>%retfile%
goto :eof
:PEnd
echo,
pause
:End
echo End!
ilcpp.bat
@echo off
set cppdll=%1
set dlldir=%~d1%~p1
set cppdir=%~d1%~p1
set outdir=.\ilout
set copydir=%cppdir%\ilout\
set dataname=""
for /f "delims=" %%a in ('dir %dlldir%*. /b') do call :FindDataDir %%a
if "%dataname%"=="" (goto Errordataname)
echo dataname find: %dataname%
set cppmeta=%cppdir%%dataname%\il2cpp_data\Metadata\global-metadata.dat
md %outdir% 2>null
md %copydir% 2>null
copy /Y %cppdll% .\GameAssembly.dll
copy /Y %cppmeta% .\global-metadata.dat
rem C#
rem Il2CppDumper.exe GameAssembly.dll global-metadata.dat <nul
rem echo Y|Il2CppDumper.exe GameAssembly.dll global-metadata.dat
Il2CppDumper.exe GameAssembly.dll global-metadata.dat
copy config.json %outdir%
copy dump.cs %outdir%
copy ida.py %outdir%
copy ida_with_struct.py %outdir%
copy il2cpp.h %outdir%
copy ilbase.h %outdir%
copy script.json %outdir%
copy stringliteral.json %outdir%
xcopy %outdir% %copydir% /Y
goto :eof
:FindDataDir
set curfile=%1
set endname=%curfile:~-5%
if "%endname%"=="_Data" (goto FindDataDirOK)
goto :eof
:FindDataDirOK
set dataname=%curfile%
goto :eof
:Errordataname
echo dataname find fail!
goto :eof
标签:BAT,set,goto,记录,批处理,writeresult,echo,%%,call
From: https://www.cnblogs.com/zzz3265/p/17802948.html