Reputation: 299
Running below
@echo off
setlocal enableDelayedExpansion
set "targetlocation=C:\Users\myself\Documents\FOLDER WITH BLANK SPACES\"
for %%f in (!targetlocation!*) do echo %%f
pause
prints:
C:\Users\myself\Documents\FOLDER
WITH
BLANK
Press any key to continue . . .
I tried to implements the following change, but it fails to run (see source below)
for f/ "delim=" %%f in (!targetlocation!*) do echo %%f
batch file for loop with spaces in dir name
Upvotes: 0
Views: 894
Reputation: 9545
Try with :
set targetlocation="C:\Users\myself\Documents\FOLDER WITH BLANK SPACES\"
Upvotes: 1