【发布时间】:2019-02-25 10:41:11
【问题描述】:
Set WshShell = CreateObject("WScript.shell")
WshShell.Run "cmd /K cd /d D:\Path\&abcd.bat"
wait 5
WshShell.SendKeys "{ENTER}"
线
WshShell.Run "cmd /K cd /d D:\Path\&abcd.bat"
工作正常,运行 abcd.bat 文件(运行文件,然后命令提示符要求按 enter 键),但按 Enter
WshShell.SendKeys "{ENTER}"
不工作。 QTP/UFT 什么都不做,跳过这行代码,移到下一行。
我试过了
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "~"
WshShell.SendKeys "(Chr(13))"
没有任何效果。
【问题讨论】:
-
尝试
echo.|abcd.bat或者更好地将echo.|添加到需要 Enter 的命令中。