windows下执行批处理 路径有空格 执行错误 10
这是我的批处理文件:@echooffsetlocaldisabledelayedexpansionset"dir=%1"set"file=%2"set"old=%3"se...
这是我的批处理文件:
@echo off
setlocal disabledelayedexpansion
set "dir=%1"
set "file=%2"
set "old=%3"
set "new=%4"
findstr /s /m /c:"%old%" "%dir%\%file%" >..tmp
for /f "delims=" %%i in (..tmp) do (
findstr /n .* "%%i" >..tmp
(
for /f "delims=" %%a in (..tmp) do (
set str=%%a
setlocal enabledelayedexpansion
set "str=!str:%old%=%new%!"
echo,!str:*:=!
endlocal
)
) >"%%i"
)
del ..tmp
用于替换文件夹下指定文件的字符串
但是当路径中存在空格时修改会失败,请问怎么改? 展开
@echo off
setlocal disabledelayedexpansion
set "dir=%1"
set "file=%2"
set "old=%3"
set "new=%4"
findstr /s /m /c:"%old%" "%dir%\%file%" >..tmp
for /f "delims=" %%i in (..tmp) do (
findstr /n .* "%%i" >..tmp
(
for /f "delims=" %%a in (..tmp) do (
set str=%%a
setlocal enabledelayedexpansion
set "str=!str:%old%=%new%!"
echo,!str:*:=!
endlocal
)
) >"%%i"
)
del ..tmp
用于替换文件夹下指定文件的字符串
但是当路径中存在空格时修改会失败,请问怎么改? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询