如何创建将运行cmd和带参数的exe的批处理文件


2

如何创建执行以下操作的批处理文件:
例如,程序名称hi.exe将执行以下操作:

  1. hi.exe使用参数在cmd中运行hi.exe -f%l%
  2. 而不是%1%我希望用户输入他选择的号码。

Answers:


3

1)您无需单独打开cmd窗口。您可以使用start命令后跟exe的路径。点击此处:https//stackoverflow.com/questions/221730/bat-file-to-run-a-exe-at-the-command-prompt

2)要读取参数,您可以使用如下语句:set /p name= What is your name?提示用户提问“您的名字是什么?” 并接受变量'p'中的输入。点击此处查看更多信息:https//stackoverflow.com/questions/1223721/in-windows-cmd-how-do-i-prompt-for-user-input-and-use-the-result-in-another-com

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.