Search found 2 matches

by rscanny
13 Aug 2021 01:41
Forum: DOS Batch Forum
Topic: Spaces folder names in FOR loop
Replies: 3
Views: 4037

Re: Spaces folder names in FOR loop

The one place you needed quotes was around %remove%. However, because this is a file, you need to tell for /f that the thing in quotes is a file and not a string, so you also need to add the usebackq option. for /f "usebackq delims=" %%f in ("%remove%") do del /Q "%%f" 2>NUL This worked perfectly, ...
by rscanny
12 Aug 2021 03:50
Forum: DOS Batch Forum
Topic: Spaces folder names in FOR loop
Replies: 3
Views: 4037

Spaces folder names in FOR loop

I have a script that scans a directory and deletes any files that are listed in a text file. The script works great except for when it encounters a space in a folder name. I've tried using " " to stop the error occurring but to no avail. I've tried using " " in the variables set at the start of the ...