Hi all, I have a batch file to check if a process is running. If the process is running then it should quit the script and if the process is not running then it should go ahead and copy files to the client. If I run the batch file as it is it works no problem.
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto ProcessFound
echo %EXE% is running
echo quitting script
echo %EXE% is not running
xcopy \\xxxxxx\xxx\newestversion\* C:\xxxxxx\ /Y /E
echo Program should be installed at this point
I need to create an install package in PDQ Deploy and this is where the problems start. In the package I have a Command Step with the following.
CALL "\\xxxxx\update_files.bat" /Q
This also works, it calls the batch file which checks for the running process and then proceeds as defined.
If the script finds the process not running it proceeds with copying the files, enters the output in the Output Log and continues the script with a Success return code. This is good.
If the script finds the process running it sends to the Output Log
Program.exe is running
also with a Success return code and then continues (more steps in the package), this is not good.
The problem is that both parts return Success codes and I cannot differentiate if the files were copied or not. If the files were copied then it is a Success, if the file copy was skipped then it is a Failure.
Is there any way to get the right result?
Please sign in to leave a comment.