概述:创建批处理的通用模板
模板
@echo off
setlocal enabledelayedexpansion
echo 开始工作,当前目录为: %cd%
for /F "tokens=1,2 delims=#" b in (1) do rem"') do (
set "DEL=%%a"
)
:start
:: 参数1为空情况下打印提示
if "%~1"=="" (
call :ColorText 0C "[Error]没有提供参数1"
echo.
call :UsagePrint
echo.
goto:eof
)
::bcdedit /set testsigning on
::启动
::bcdedit /debug on
goto:eof
:UsagePrint
call :ColorText 02 "[Usage]:"
echo.
call :ColorText 02 " %~nx0 [OutputDir] [ui version]"
echo.
goto:eof
:: call :ColorText 0C "red"
:: call :ColorText 0b "blue"
:: call :ColorText 02 "green"
:: call :ColorText 19 "yellow"
:: call :ColorText 2F "black"
:: call :ColorText 4e "white"
:ColorText
@echo off
:: 移除冒号
set "input=%~2"
set "input=!input::=:!"
<nul set /p ".=%DEL%" > "!input!"
findstr /v /a:%1 /R "^$" "!input!" nul
del "!input!" > nul 2>&1
goto :eof
pause