Im trying to delete files by name and path entrys saved to a text file if the concerning file or folder Path/ name dose notcontain spaces the batch executes nicely, however if the file name contains spaces it refuses to read beyond the first space. this is regardless of quotation marks.
could sombody please help?
for /f %%1 in (C:\BLACKLIST.txt) do rd /s /q %%1
also not working is:
for /f %%1 in (C:\BLACKLIST.txt) do rd /s /q "%%1"
You need to add tokens to get it to read the whole line
The
for /floop reads lines and splits them into tokens based on certain delimiter or delimiters. By default, the delimiters are<space>and<tab>, and, if not specified, only the first token is read. Thetokensoption lets you override the default and specify which tokens you want. In your case, you want all of them, that’s why you need to put*(a single*stands for “all tokens”).Alternatively, you could just specify “no delimiter”, by resetting the
delimsoption, like this: