2016-09-21 32 views
-1

我正在寻找一个VBscript代码,当用户打开任何应用程序/特定应用程序时,它将提示消息框。而且,VBScript应该始终在运行。 我是新来的编码。请帮忙!!vbscript提示文件执行消息

+0

请分享您迄今为止所尝试的内容。 – kfb

回答

1
Set WshShell = WScript.CreateObject("WScript.Shell") 
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") 
Set objEvents = objWMIService.ExecNotificationQuery _ 
    ("SELECT * FROM Win32_ProcessStopTrace") 

Do 
    Set objReceivedEvent = objEvents.NextEvent 
    msgbox objReceivedEvent.ProcessName 
    If lcase(objReceivedEvent.ProcessName) = lcase("Notepad.exe") then 
     Msgbox "Process exited with exit code " & objReceivedEvent.ExitStatus 
     WshShell.Run "c:\Windows\notepad.exe", 1, false 
    End If 
Loop 

这会让你开始。这监视进程的退出。将Win32_ProcessStopTrace更改为Win32_ProcessStartTrace以执行过程开始。

相关问题