目录名称/中有空格的循环批处理文件/(/f "delims=" 不起作用)
batch file for loop with spaces in dir name / (/f "delims=" not working)
运行低于
@echo off
setlocal enableDelayedExpansion
set "targetlocation=C:\Users\myself\Documents\FOLDER WITH BLANK SPACES\"
for %%f in (!targetlocation!*) do echo %%f
pause
打印:
C:\Users\myself\Documents\FOLDER
WITH
BLANK
Press any key to continue . . .
我尝试实施以下更改,但未能成功 运行(请参阅下面的源代码)
for f/ "delim=" %%f in (!targetlocation!*) do echo %%f
batch file for loop with spaces in dir name
试试:
set targetlocation="C:\Users\myself\Documents\FOLDER WITH BLANK SPACES\"
运行低于
@echo off
setlocal enableDelayedExpansion
set "targetlocation=C:\Users\myself\Documents\FOLDER WITH BLANK SPACES\"
for %%f in (!targetlocation!*) do echo %%f
pause
打印:
C:\Users\myself\Documents\FOLDER
WITH
BLANK
Press any key to continue . . .
我尝试实施以下更改,但未能成功 运行(请参阅下面的源代码)
for f/ "delim=" %%f in (!targetlocation!*) do echo %%f
batch file for loop with spaces in dir name
试试:
set targetlocation="C:\Users\myself\Documents\FOLDER WITH BLANK SPACES\"