31
此代码不能正常工作:如何从当前目录中删除文件夹及其所有内容?
@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
此代码不能正常工作:如何从当前目录中删除文件夹及其所有内容?
@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 它会删除整个目录树,但问用户,如果它应该先行
你发现了什么问题? DELTREE在许多当前版本的Windows中不存在。根目前是否是目录? –