I'm trying to schedule a script to run on windows. The triggering part works fine. The important part of my script looks like:
start C:\staging-script -arg1 arg -arg2 arg & ECHO "Did staging"
start C:\prod-script -arg1 arg -arg2 arg & ECHO "Did prod"
When I run it from cmd.exe, two more cmd windows are opened, both execute the script, and then the windows don't close. When I try to use Windows scheduler for this, it fails because the "resource is still in use"
Additionally, the ECHOs happen in the original window (which is where they should happen) but happen right away, not when the start task completes.
start
creates an independent process. Once the process is started, the message is produced and the next line executed.
If you want the two start
ed processes to execute in parallel and you're only bothered by those processes' windows' not closing, insert
exit
in the scripts start
ed
If you want to execute the processes serially, that is complete process1 before producing the message and starting process2, then CALL
the batches, don't start
them.
尝试在Windows执行的每个脚本的末尾添加exit。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.