CMD 批处理文件实际上按下回车键

CMD 批处理文件实际上按下回车键

我在一家制造公司工作。我们制造硬盘的 PCB。制造过程中,每个 PCB 都需要加载固件。我会打开应用程序,浏览合适的ini文件,然后开始将固件上传到 PCB。我的问题是,当我最初打开应用程序时,它会显示一些带有窗口名称“警告“CRC 错误。然后我会通过点击关闭此窗口好的按钮或“X“按钮在角落里,然后加载正确的ini文件并开始上传过程。我想创建一个批处理文件,它将打开 FW 应用程序并关闭此警告窗口。我发现只有三种可能的方法。

  1. 批处理文件必须实际上按下“进入“键单击确定按钮关闭警告窗口。
  2. 批处理文件必须虚拟按下角落“X“按钮关闭警告窗口。
  3. 批处理文件必须查找窗口名称“警告"并将其关闭。

我在网上搜索解决方案,但最终无能为力。如果有任何方法,那将非常有帮助。

答案1

Autohotkey 是一款出色的免费应用程序,可以满足您的要求 -http://www.autohotkey.com/board/topic/20202-automatically-clicking-ok-in-a-dialog-box/

答案2

TaskKill  /f /Im whatever.exe /t <--Kills all Instances
TaskKill /f /fi "windowtitle eq whatever - Internet Explorer" /im "iexplore.exe" /T <--Isolates the specific But Tricky To Determine Exact window title. The /f is force the /t is any other System process started by it Closes to. 

仅当消息窗口作为与初始应用程序分开的任务显示时,这才会起作用。

--替代方法自动创建 VBS 脚本--

Echo set oshell = createobject("wscript.shell") >PressEnter.vbs        
Echo oshell.sendkeys "{enter}" >>PressEnter.vbs      
Echo wscript.quit >>PressEnter.vbs     
Start PressEnter.vbs     
Del /Q PressEnter.vbs       

相关内容