0

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

Community
  • 1
  • 1
BuckTurgidson
  • 289
  • 3
  • 8
  • 17

1 Answers1

1

Try with :

set targetlocation="C:\Users\myself\Documents\FOLDER WITH BLANK SPACES\"
SachaDee
  • 9,245
  • 3
  • 23
  • 33