Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba Powershell Wscript.Shell弹出超时未超时_Vba_Powershell - Fatal编程技术网

Vba Powershell Wscript.Shell弹出超时未超时

Vba Powershell Wscript.Shell弹出超时未超时,vba,powershell,Vba,Powershell,我使用了$wshell.Popup($time,$time,'Warning',48+4096)作为超时的弹出窗口。当我以5的超时时间编写代码时,一切都运行得很好,但当我投入生产时,超时时间更长,无法正常工作。所以我写了下面的代码来说明这种奇怪的行为。超过19秒的值在我的计算机上不起作用。有没有人经历过同样的问题?如何解决这个问题 (我有PSVersion:5.1.18362.1171和VBScript.5.8.16384) 产出: pop up 1 took 1.1034666 pop up

我使用了
$wshell.Popup($time,$time,'Warning',48+4096)
作为超时的弹出窗口。当我以5的超时时间编写代码时,一切都运行得很好,但当我投入生产时,超时时间更长,无法正常工作。所以我写了下面的代码来说明这种奇怪的行为。超过19秒的值在我的计算机上不起作用。有没有人经历过同样的问题?如何解决这个问题

(我有PSVersion:5.1.18362.1171和VBScript.5.8.16384)

产出:

pop up 1 took 1.1034666
pop up 2 took 2.1012811
pop up 3 took 3.1027432
pop up 4 took 4.1011674
pop up 5 took 8.8805263
pop up 6 took 6.1285214
pop up 7 took 13.8968735
pop up 8 took 8.1029593
pop up 9 took 11.9174401
pop up 10 took 19.0161058
pop up 11 took 19.0150746
pop up 12 took 19.0156603
pop up 13 took 19.0159296
pop up 14 took 19.030777
pop up 15 took 19.0175581
pop up 16 took 19.0388007
pop up 17 took 19.0392871
pop up 18 took 19.043456
pop up 19 did not end after 270 seconds...
作为隔离问题的测试,我创建了这个vbs文件。30秒后成功超时:

CreateObject("WScript.Shell").Popup "Hello!", 30, "Title", 4144

PowerShell 5.1.19041.906在此,无法复制。(WshShell是一个COM对象,因此PowerShell版本应该与其行为完全无关)…换句话说,您可以用VBScript编写相同的内容,并查看其行为是否相同吗?版本:VBScript.5.8.16384我尝试使用类似的代码创建一个vbs文件,该代码正常工作。我更新了上面的问题。有什么想法吗?没有。就WshShell对象而言,VBScript是使用COM与WshShell对象交互,还是Powershell使用COM与WshShell对象交互,都没有任何区别。实际上,没有理由会失败,并且在某个“秒”值下失败。但为了继续前进,你可以考虑转换。一个简单的定时对话框应该比较容易实现。使用相同的PS版本,我将PopUp方法的第一个参数更改为
$time.ToString()
,对我来说,它工作正常。
CreateObject("WScript.Shell").Popup "Hello!", 30, "Title", 4144