1. Check if notepad.exe process is running
2. If running go to end
3. Else play the sound and start notepad.exe
This script works on Windows XP Pro x32 but when I try to run the job on a version of XP Pro x64 it plays the sound every time even if the process is running, but doesn't restart the process. So even though it says go to end and bypass playing the sound it still does every time the script is executed.
Any help would be appreciated.....
tasklist /FI "IMAGENAME eq notepad.exe" /FO CSV > search.log
FOR /F %%A IN (search.log) DO IF %%~zA EQU 0 GOTO end
start "" /min mplayer2 "c:\Windows\Media\error.wav" /play /close
start notepad.exe
:end
del search.log