Batch Files and the Remove Directory Command (RMDIR)
When I use the RMDIR command in my batch files immediately followed by the IF statement to check to see if the directory has been removed, the result is that the directory is not removed. It appears that the IF statement starts execution before the RMDIR command completes its processing. This does not happen with Windows XP. And it should not happen in any operating system.
March 28th, 2010 7:53am

Are you sure that the folder is actually removed? Maybe the folder still exists because you do not have permissions to remove it. In this case you may need to run the batch file as administrator. Arthur Xie - MSFT
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 11:07am

What sounds like is happening is that you're running a console command line application (e.g., rmdir.exe) rather than a built-in command. Under some conditions console applications can start but the command processor will not wait for them to finish unless you use the START /WAIT command prefix. Do you, by chance, have the Gnu Toolkit installed? It has an rmdir command in it, and it will even work in the simple case as the folder syntax (no switches) is the same. Several other common toolkits sport rmdir commands as well. A workaround, if you do have an rmdir.exe executable in your path is to try using RD instead of RMDIR in your batch files. Of course if you do this you'll want to be sure you don't have an rd.exe anywhere in your path. -Noel
March 30th, 2010 5:53pm

One additional thing... Are you sure you have your RMDIR command syntax correct? It might help to post a snippet of your batch file here for other eyes to review. -Noel
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 9:00pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics