在命令提示符中模拟输入键不起作用

问题描述 投票:0回答:2
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))"

没有任何效果。

vbscript qtp hp-uft
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.