Jump to content
  • Announcements

    • admin

      PBS Forum Has Closed   06/12/17

      The PBS Works Support Forum is no longer active.  For PBS community-oriented questions and support, please join the discussion at http://community.pbspro.org.  Any new security advisories related to commercially-licensed products will be posted in the PBS User Area (https://secure.altair.com/UserArea/). 
Sign in to follow this  

PBS Job dependency script on Windows

Recommended Posts

Hello everyone!


I have a question regarding submitting job script with dependency. For example I have job1.pbs and job2.pbs. I want job2.pbs execute after job1.pbs have finished.

After surfing in the internet, I’ve found that I must create a shell script like this:



FIRST=$(qsub job1.pbs)

echo $FIRST

SECOND=$(qsub -W depend=afterany:$FIRST job2.pbs)

echo $SECOND


But this thing only works in UNIX environment whilst mine is Windows.

Do you know what kind of script should I create in Windows to make this work?


Thanks for the reply.

Share this post

Link to post
Share on other sites

This will work from a Windows .bat file:


@echo off

for /f "delims=" %%a in ('qsub job1.pbs') do @set FIRST=%%a
echo %FIRST%
for /f "delims=" %%a in ('"qsub -W depend=afterany:%FIRST% job2.pbs"') do @set SECOND=%%a
echo %SECOND%


Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this