如何使.bat文件在删除时不问您?

时间:2014-03-07 03:20:53

标签: batch-file cmd

如果我把

del "\Users\Chris\example"

...它说“你确定要删除是吗?是/否?”

有没有办法可以删除文件而不问我?

2 个答案:

答案 0 :(得分:2)

del / F / Q应该这样做......你应该真的做HELP DEL - 因为这只是在手册中

Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

  names         Specifies a list of one or more files or directories.
            Wildcards may be used to delete multiple files. If a
            directory is specified, all files within the directory
            will be deleted.

/P            Prompts for confirmation before deleting each file.
/F            Force deleting of read-only files.
/S            Delete specified files from all subdirectories.
/Q            Quiet mode, do not ask if ok to delete on global wildc
/A            Selects files to delete based on attributes
              attributes    R  Read-only files            S  System files
            H  Hidden files               A  Files ready for archi
            -  Prefix meaning not

答案 1 :(得分:1)

del /Q 

来自del /?

/Q            Quiet mode, do not ask if ok to delete on global wildcard