How to skip “are you sure Y/N” when deleting files in batch files

前端 未结 4 1987
后悔当初
后悔当初 2020-12-24 11:16

I can\'t for the life of me remember how to bypass the annoying prompt are you sure? Y/N when deleting files.

I seem to recall it was something like:

相关标签:
4条回答
  • 2020-12-24 11:55

    I just want to add that this nearly identical post provides the very useful alternative of using an echo pipe if no force or quiet switch is available. For instance, I think it's the only way to bypass the Y/N prompt in this example.

    Echo y|NETDOM COMPUTERNAME WorkComp /Add:Work-Comp
    

    In a general sense you should first look at your command switches for /f, /q, or some variant thereof (for example, Netdom RenameComputer uses /Force, not /f). If there is no switch available, then use an echo pipe.

    0 讨论(0)
  • 2020-12-24 11:58

    You have the following options on Windows command line:

    net use [DeviceName [/home[{Password | *}] [/delete:{yes | no}]]
    

    Try like:

    net use H: /delete /y
    
    0 讨论(0)
  • 2020-12-24 12:04

    Add /Q for quiet mode and it should remove the prompt.

    0 讨论(0)
  • 2020-12-24 12:07

    Use del /F /Q to force deletion of read-only files (/F) and directories and not ask to confirm (/Q) when deleting via wildcard.

    0 讨论(0)
提交回复
热议问题