В одной из тем Petya V4sechkin, предложил решение
bat
Код:
@Echo Off
SetLocal EnableExtensions
Set ProcessName=notepad.exe
TaskList /FI "ImageName EQ %ProcessName%" | Find /I "%ProcessName%"
If %ErrorLevel% NEQ 0 Start %windir%\%ProcessName%
vbs
Код:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery( _
"Select Name From Win32_Process " _
& "Where Name = 'notepad.exe'")
If colProcesses.Count = 0 Then
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Run "notepad.exe"
End If