这个代码不起作用:
@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
你正在寻找这个命令:
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
在你的情况下只需使用/ S它会删除整个目录树,但询问用户是否应该先进行