This code that does not work:
@echo off
if exist output @set /p checkdir= Output directory found. Do you wish to overwrite it?:
if /I %checkdir% == Y deltree /s /output
pause
You were looking for this command:
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S
In your case just use /S ,it will delete the whole directory tree by first asking the user if it should proceed, ie- displaying the following output to the screen:
"folderName, Are you sure (Y/N)?"
where folderName
is the name of the folder (and its sub-folders) you wish to remove.
Tested on Windows 7, 64 bit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.