lunedì 10 luglio 2023

File VbScript - Controllare se Processo Avviato e Attendere Chiusura

Vi riporto il codice di un VbScript che monitora se il processo NOTEPAD.EXE è avviato, nel caso lo sia attende fino a quando non viene chiuso.

-----------------------------------------------------------------
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
On Error Resume Next
Do
   Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'notepad.exe'").ItemIndex(0)
   If Err.Number <> 0 Then Exit Do
Loop
wscript.echo "Notepad Chiuso"
-----------------------------------------------------------------

Etichette: , , , , ,

0 Commenti:

Posta un commento

Iscriviti a Commenti sul post [Atom]

<< Home page