You could try to hide the folders before the for-loop, and unhide them afterwards, like this:
ATTRIB +H D:\myfolder\keepit
FOR /D %%i IN ("D:\myfolder\*") DO RD /S /Q "%%i" DEL /Q "D:\myfolder\*.*"
ATTRIB -H D:\myfolder\keepit
More Related Contents:
- Batch file v PowerShell script
- How can you find and replace text in a file using the Windows command-line environment?
- Single line with multiple commands using Windows batch file
- How do I run two commands in one line in Windows CMD?
- Batch command date and time in file name
- How to check if a process is running via a batch script
- How to echo with different colors in the Windows command line [closed]
- Stop and Start a service via batch or cmd file?
- Show a popup/message box from a Windows batch file
- Create an empty file on the commandline in windows (like the linux touch command)
- How to prevent auto-closing of console after the execution of batch file
- How do I shutdown, restart, or log off Windows via a bat file?
- Why %processor_architecture% always returns x86 instead of AMD64
- Windows shell command to get the full path to the current directory?
- How do I minimize the command prompt from my bat file
- How do I get the equivalent of dirname() in a batch file?
- Why doesn’t my stderr redirection end after command finishes? And how do I fix it?
- how to empty recyclebin through command prompt?
- Difference between %variable% and !variable! in batch file
- Batch file: Find if substring is in string (not in a file)
- Batch character escaping
- Set the value of a variable with the result of a command in a Windows batch file [duplicate]
- What does %date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2% mean?
- Windows batch script to read an .ini file
- Counting in a FOR loop using Windows Batch script
- Special Characters in Batch File
- Batch to remove duplicate rows from text file
- How do you strip quotes out of an ECHO’ed string in a Windows batch file?
- windows cmd: problems with for /f with a quoted command with quoted parameters
- Batch file to upload .txt to FTP