标签:斜杠 [] size dexp 字符 etl efi find 替换
@echo off
setlocal EnableDelayedExpansion
set dv=f
set bootdisk=c:
set "x=f:\boot\imgs\WePE_64_V1.2.iso"
rem 如果变量x里面含有/左斜杠,则不能被作为关键词,必须加上\逃脱字符
rem set "x=WePE_64_V1.2.iso"
set x=!x:%dv%:=!
set x1=!x:\=/!
set x=!x:\=\/!
echo !x!
rem for /f "skip=2 tokens=1 delims=[]" %%i In (‘find /N /I "!x1!" "%bootdisk%\menu.lst"‘) Do set /a y1=%%i-3
rem if defined y1 echo %y1%
for /f %%i in (‘sed -n "/%x%/=" "%bootdisk%\menu.lst"‘) do set /a y=%%i-3
if defined y echo %y%
if defined y (sed -i "%y%,/chainloader/d" "%bootdisk%\menu.lst")
start "1" "%bootdisk%\menu.lst"
pause
标签:斜杠 [] size dexp 字符 etl efi find 替换
原文地址:https://www.cnblogs.com/liuzhaoyzz/p/10843705.html