How to supply console input ( yes / no ) as part of batch file on Windows.

后端 未结 6 889
春和景丽
春和景丽 2020-12-08 08:33

I am writing a simple batch file (remove.bat) to remove a directory and all its subdirectories. The file contains the following command-

rmdir /S modules
         


        
6条回答
  •  暖寄归人
    2020-12-08 08:55

    If you are not dealing with a windows with a english/us locale you might need to retrieve the answers needed for your machine:

    @echo off
    
    setlocal
    
    set "ans_yes="
    set "ans_no="
    set "ans_all="
    
    copy /y nul # >nul
    
    for /f "tokens=2-7 delims=[(/)]" %%a in ( '
        copy /-y nul # ^

提交回复
热议问题