Process Check & Conditional App Boot Script for Windows

Jan 17, 2009 18:02


@echo off
process -v | find /i "firefox.exe"
if %errorlevel% equ 0 echo+Process running
if %errorlevel% equ 1 echo+Process not running.& call Firefox.bat

This uses Process.exe by Craig Peacock and find.exe, a standard Windows utility (equivalent of Grep) to get the process name.

Any command-line utility returning a process name will work (a port of Unix ps command, System Internals' pslist.exe, etc.).

This script checks for firefox.exe in the process listing, then boots it in case firefox.exe is not running.

The script can be scheduled to run by Cron for Windows. Another Win32 port of Cron.

system administration

Previous post Next post
Up