This works also for UNC paths by default because of command extensions are enabled by default and in this case PUSHD creates a temporary drive letter that points to that specified network resource and then changes the current drive and directory, using the newly defined drive letter. The first command PUSHD pushes current directory path on stack and next makes %PathToFolder% the current directory for running command process. This command line contains three commands executed one after the other. ![]() The simple single command line solution which of course can be also used in a batch file: pushd "%PathToFolder%" 2>nul & ( rd /Q /S "%PathToFolder%" 2>nul & popd ) That's the reason for posting one more answer with a very simple single command line to delete all files and subfolders of a folder as well as a batch file with a more complex solution explaining why all other answers as posted on using DEL and FOR with RD failed to clean up a folder completely. None of the answers as posted on, with the exception of the single command line posted by foxidrive, really deletes all files and all folders/directories in %PathToFolder%.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |