BatchPatch Forums Home › Forums › BatchPatch Support Forum › Problems using If specified file exists in job queue
Tagged: job queue
- This topic has 2 replies, 2 voices, and was last updated 5 years ago by doug.
-
AuthorPosts
-
July 22, 2020 at 12:37 pm #12413suewParticipant
I’ve been fighting with exit codes in powershell scripts not always making it back correctly when deploying the scripts (I suspect they’re being swallowed by the cmd.exe), so I decided to try using the built-in “If specified file exists, goto” to replace one of my scripts.
The file is under the “Program Files (x86)” directory. When I query for the file existence using the Get information > Check if file exists function, it works just fine. However, when I try the same thing in the job queue, it fails. The message returns “File Existence: FALSE: C:\Program Files (x86 does not exist.”
It seems to have a problem with parenthesis. I’ve tried both with quotes and without, but no luck.
Any suggestions?
July 22, 2020 at 1:58 pm #12414suewParticipantJust another issue. I have the same problem if I use the If version of specified file is older/newer than Y, goto X.
July 22, 2020 at 3:26 pm #12415dougModeratorYou found a bug. Thank you for reporting this. We will have all four of those job queue items fixed in the next release.
In the meantime we have a few custom script integration examples posted at the following links. These examples are written in vbscript, not powershell, but they might help give you some ideas for how you could accomplish your goal. For example if you want to have the job queue check for file existence or file version on a file that is currently failing due to the parenthesis bug/issue you described above, you could use a script that checks for the existence of the file and then returns 0 or 1 depending on whether or not it finds the file. Then in BatchPatch you could create a Deployment job to execute the script, and then insert that Deployment job in the Job Queue right before using the step ‘If previous action failed/errored (returned non-0), goto label:X’ or ‘If previous action was successful (returned 0), goto label:X’
https://batchpatch.com/advanced-script-integration-with-batchpatch
https://batchpatch.com/advanced-script-integration-with-batchpatch-part-2
-
AuthorPosts
- You must be logged in to reply to this topic.