I am making a batch script and part of the script is trying to remove a directory and all of its sub-directories. I am getting an intermittent error about a sub-directory not be
I can think of the following possible causes:
For 1.) you can try runas /user:Administrator
in order to get higher privileges or start the batch file as administrator via context menu. If that doesn't help, maybe even the administrator doesn't have the rights. Then you need to take over the ownership of the directory.
For 2.) download Process Explorer, click Find/Find handle or DLL...
or press Ctrl+F, type the name of the directory and find out who uses it. Close the application which uses the directory, if possible.