使用批处理文件输入字母以在cmd中执行操作



我有一个在命令提示符下运行的.exe,然后它要求我按字母来执行任务。我想要一个运行.exe文件并按 y 执行操作的批处理文件。这是我到目前为止所拥有的:

start cmd.exe /k ""C:UsersmayesDocumentsUtilitiesMacrosSecond Keyboard MacrosInterceptinterceptintercept.exe""

它所做的只是打开.exe文件。我也需要它来按 y。

演示我希望批处理文件执行的操作:

https://media.giphy.com/media/Ujsia9OeUqJuo/giphy.gif

所以还有另一种更简单的方法,该程序内置了参数,

C:Stackintercept>intercept.exe /help
*** Keyboard Remapper v. 1
*** Based on Oblitum Interception http://oblita.com/Interception.html
Use /help for help on command-line options
Command line parameters:
/ini path       oile.ini specify alternate config file (optional)
/apply                non-interactive, apply filters on startup (optional)
C:Stackintercept>

如果你输入/help那么只需用/apply做一个快捷方式,你就是黄金!这是一个有用的提示,通过键入/help来检查控制台应用程序的内置参数和选项。

您可以使用VB脚本发送密钥 女巫可以从批处理运行。 试试这个:

set shell = CreateObject("WScript.Shell")
shell.run"C:UsersmayesDocumentsUtilitiesMacrosSecond Keyboard MacrosInterceptinterceptintercept.exe"
WScript.Sleep 1500
shell.SendKeys"{Y}"
shell.SendKeys"{ENTER}"

将其另存为.vbs,并且您想要从批处理运行它,您可以使用:

cscipt "nameoffile".vbs

希望它对你有用!

最新更新