1

我需要在用户关闭记事本时打开记事本和注销计算机的 vbs 中的脚本。我有打开的代码

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""c:\Program Files\Mozilla Firefox\firefox.exe""")
Set objShell = Nothing

和注销

Dim oShell
Set oShell = CreateObject("Shell.Application")
oShell.ShutdownWindows

但我需要比较一下。感谢帮助。

4

1 回答 1

0

您可以使用单个脚本,等待记事本(或 firefox)进程结束,然后关闭窗口,如下所示:

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
'run command reference : http://msdn.microsoft.com/en-us/library/d5fk67ky%28v=vs.84%29.aspx
objShell.Run """c:\Program Files\Mozilla Firefox\firefox.exe""", 1, True
Set objShell = Nothing
'logoff
Dim oShell
Set oShell = CreateObject("Shell.Application")
oShell.ShutdownWindows

注意:“oShell.ShutdownWindows”不会强制关机,只会显示关机对话框。

于 2013-08-08T16:00:22.393 回答