By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to handle folders with special characters in their names


I have a personalized CleanUp TCC script that removed Dump files and other leftovers; it works pretty well 99.99% of the time. However, eventually, Malwarebytes creates a Dump file (.dmp) in a directory named C:\Windows\%LOCALAPPDATA% (literally), and the script fails to delete the file(s) in it because after expanding %LOCALAPPDATA% the directory name becomes C:\Windows\C:\Users\UserName\AppData\Local, which is obviously invalid.
I tried fooling around with SETDOS options, but if I disable expansion, other variables don't get expanded as they should. Am I missing something obvious?

I am almost positive this might have happened to other people as well; therefore I'd appreciate any suggestions.

Here the snippet of the code I use:

C:\Everything\es.exe -s -path C:\ -export-txt %PurgeList% *.dmp

For %File In (@%PurgeList%) Do (
Echo ``
Dir /ghkm "%File"
Pause /w300 /c Press any key to delete the file %File% or Ctrl-C to abort...
Del /efyz "%File"

Where the file in %PurgeList% contains the names of all the Dump files in the disk.

Any help is sincerely appreciated.
A terrible filename; the programmer responsible deserves strappado.

SETDOS /X-4 might be helpful here.
Charles, I agree 100% with your statement. I have already complained with Malwarebytes about the bad filename choice.

I will try SETDOS /x-4 right now.

Thanks so much.