|I need to create a batch file that will run an exe that will test out the readability of a CD. The process is supposed to work out as follows:|
1. The PC & OS loads up, and the CD checking .exe will automatically execute
2. Another batch file will need to check whether or not this program is still executing, say, every 25 seconds - it will do this by creating a text file that lists all currently running processes and searching through the list to see if the process is present
3. If the process is present, the program will loop to the beginning and wait again, and check again
4. If the process isn't present, then the PC will restart and the process will start all over again.
My code is as follows:
tasklist > %tempfile%
tasklist /fi "readtest.exe"
if errorlevel 0 if not errorlevel 1 goto IsRunning
echo This process is running
The problem I am having is that the program is loading OK, but the text file isn't getting created, and so the checking on whether the process is still active is therefore also malfunctioning.
Any help would be hugely appreciated as I have been trying to get this to work for too long!