使用批处理文件输入字母以在cmd中执行操作
Use batch file to input letter to perform action in cmd
我有一个在命令提示符下运行的 .exe,然后它要求我按一个字母来执行任务。我想要一个运行 .exe 文件并按 y 来执行操作的批处理文件。这是我目前所拥有的:
start cmd.exe /k ""C:\Users\mayes\Documents\Utilities\Macros\Second Keyboard Macros\Intercept\intercept\intercept.exe""
它所做的只是打开 .exe 文件。我也需要它来按 y。
演示我希望批处理文件执行的操作:
您可以使用 vb 脚本发送密钥 可以是 运行 批处理。
试试这个:
set shell = CreateObject("WScript.Shell")
shell.run"C:\Users\mayes\Documents\Utilities\Macros\Second Keyboard Macros\Intercept\intercept\intercept.exe"
WScript.Sleep 1500
shell.SendKeys"{Y}"
shell.SendKeys"{ENTER}"
将其另存为 .vbs
,如果您想 运行 从批处理中使用它,您可以使用:
cscipt "nameoffile".vbs
希望对你有用!
所以还有另一种更简单的方法,程序内置了参数,
C:\Stack\intercept>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:\Stack\intercept>
如果您键入 /help
,那么只需使用 /apply
创建一个快捷方式,您就 GOLDEN! 这是检查控制台应用程序的有用提示通过键入 /help
.
内置参数和选项
我有一个在命令提示符下运行的 .exe,然后它要求我按一个字母来执行任务。我想要一个运行 .exe 文件并按 y 来执行操作的批处理文件。这是我目前所拥有的:
start cmd.exe /k ""C:\Users\mayes\Documents\Utilities\Macros\Second Keyboard Macros\Intercept\intercept\intercept.exe""
它所做的只是打开 .exe 文件。我也需要它来按 y。
演示我希望批处理文件执行的操作:
您可以使用 vb 脚本发送密钥 可以是 运行 批处理。 试试这个:
set shell = CreateObject("WScript.Shell")
shell.run"C:\Users\mayes\Documents\Utilities\Macros\Second Keyboard Macros\Intercept\intercept\intercept.exe"
WScript.Sleep 1500
shell.SendKeys"{Y}"
shell.SendKeys"{ENTER}"
将其另存为 .vbs
,如果您想 运行 从批处理中使用它,您可以使用:
cscipt "nameoffile".vbs
希望对你有用!
所以还有另一种更简单的方法,程序内置了参数,
C:\Stack\intercept>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:\Stack\intercept>
如果您键入 /help
,那么只需使用 /apply
创建一个快捷方式,您就 GOLDEN! 这是检查控制台应用程序的有用提示通过键入 /help
.