title: How to run loop check vbs for particular running process? Or missing process?
body: <p>I am running the following VBScript (<code>check.vbs</code>):</p>
  
  <pre><code>Set service = GetObject ("winmgmts:")
  
  For Each Process In Service.InstancesOf("Win32_Process")
      If Process.Name = "cmd.exe" Then
          WScript.Echo "cmd running"
          WScript.Quit
      End If
  Next
  CreateObject("WScript.Shell").Run("C:\system\file.bat")
  </code></pre>
  
  <p>This script will check whether <code>cmd.exe</code> is running or not. If it is running, this script will display a message "cmd running". If it is not running, this script will open a batch file <code>C:\system\file.bat</code>.</p>
  
  <p>But what I actually need is: when I run this script <code>check.vbs</code> it needs to keep on checking until it finds that <code>cmd.exe</code> is not running.</p>
  
  <p>Only if it found <code>cmd.exe</code> is not running it needs to run <code>file.bat</code> - after repeated checking in background (like any loop program).</p>
  
  <p><strong>In simple words,</strong> when opening <code>check.vbs</code> the script need to continously check that <code>cmd.exe</code> is running or not, once it found it's not running, it need to open <code>file.bat</code>.</p>