我是自动化的过程,连接到远程PC,其中包括VPN+SSH+VNC和ssh阶段自动化打开了太多的新窗口,而不是一个预期。
代码:
Set oShell = CreateObject("WScript.Shell")
oShell.Run("""G:\Git\git-bash.exe""")
oShell.AppActivate "MINGW64:/"
Dim command
command = "ssh -A username@adress options~"
oShell.SendKeys command 从3打开到5个git-bash实例,而不是1。发送键在此3-5窗口中的1中按预期工作。如何防止打开别人?
发布于 2021-12-25 12:02:09
oShell.Run(oShell.ExpandEnvironmentStrings("%COMSPEC% /C (start G:\Git\git-bash.exe)"))应该能帮上忙。
还可以尝试在调用WScript.Sleep 3000之前添加oShell.AppActivate,以便操作系统有时间启动git-bash.exe及其依赖项。
希望驱动器G:是一个本地驱动器。如果没有,则增加睡眠时间,以便给任何反病毒时间扫描该过程.
https://stackoverflow.com/questions/70443882
复制相似问题