Use:
-
Create a batch file
-
Copy the below text into the batch file
set folder="C:\test" cd /d %folder% for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
It will delete all files and folders.
More Related Contents:
- Variables are not behaving as expected
- Single line with multiple commands using Windows batch file
- Example of delayed expansion in batch file
- How do I run two commands in one line in Windows CMD?
- Batch command date and time in file name
- Windows batch: echo without new line
- Where is “START” searching for executables?
- How to test if a file is a directory in a batch script?
- Escape percent in bat file
- windows batch SET inside IF not working
- How can two text files be read in parallel by a batch file?
- Capture output command CMD
- Batch files: List all files in a directory with relative paths
- Windows batch script to parse CSV file and output a text file
- Using parameters in batch files at Windows command line
- “rd” exits with errorlevel set to 0 on error when deletion fails, etc
- Why does only the first line of this Windows batch file execute but all three lines execute in a command shell?
- Curl not recognized as an internal or external command, operable program or batch file
- What is the easiest way to reset ERRORLEVEL to zero?
- How to echo “2” (no quotes) to a file, from a batch script?
- Why is the FOR /f loop in this batch script evaluating a blank line?
- How do I minimize the command prompt from my bat file
- Path prefixes \??\ and \\?\
- What would be the Windows batch equivalent for HTML’s input type=”password”?
- Windows console %DATE% Math
- How to read input from console in a batch file?
- How can I source variables from a .bat file into a PowerShell script?
- I need to match or replace an asterisk * in a batch environmental variable using only native Windows commands. Is this possible?
- How to expand a CMD shell variable twice (recursively)
- Split %date% in a batch file regardless of Regional Settings