Is there anyway to have preset data for user input in a batch file?

前端 未结 8 1051
野趣味
野趣味 2020-12-06 19:52

So basically I have a batch file that requires alot of user input. I was wondering if it was possible to have any filler data already present when the question is asked, and

相关标签:
8条回答
  • 2020-12-06 20:49
    askingFile.cmd < response.txt
    

    Take the input to the batch from the indicated file, one line per answer

    0 讨论(0)
  • 2020-12-06 20:50

    nearly impossible to edit a preset value with pure batch, but you can easily give a default value (works, because set /p is not touching the variable, if input is empty)

    set "author=First Last"
    set /p "author=Enter name or press [ENTER] for default [%author%]: "
    echo %author%
    
    0 讨论(0)
提交回复
热议问题