Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
shashank.gece
- Posts: 3
- Joined: 12 Feb 2017 19:49
#1
Post
by shashank.gece » 12 Feb 2017 20:30
THIS IS MY CODE.
RIGHT NOW I AM USING THE DELAY OPTION.
INSTEAD OF THE DELAY COMMAND CAN I USE ANOTHER COMMAND WHICH WILL WAIT FOR THE PREVIOUS COMMAND TO FINISH AND THEN RUN THE NEXT COMMAND.
Code: Select all
@echo off
rem this file copies the name from the text file to the excel file
pushd %~dp0
start /b "" cscript final.vbs
echo. excel is being edited
rem this will wait
echo. PLEASE WAIT..............
CHOICE /N /C YN /T 5 /D Y >NUL
echo. Excel file is edited
rem this will copy the file from out folder to pdx folder
pushd %~dp0
start /b "" cscript CopyMot.vbs
echo.file is being copied
rem this will wait
echo. PLEASE WAIT...........
CHOICE /N /C YN /T 5 /D Y >NUL
echo. file is copied
rem this will run the macro
pushd %~dp0
start /b "" cscript Shashank.vbs
echo. PDX is being created
rem this will wait and kill hexview 1
echo. Closing Hexview1
CHOICE /N /C YN /T 3 /D Y >NUL
pushd %~dp0
start /b "" cscript KillProcess.vbs
echo. Hex view 1 is closed
rem this will wait and kill hexview 2
echo. Closing Hexview2
CHOICE /N /C YN /T 3 /D Y >NUL
pushd %~dp0
start /b "" cscript KillProcess.vbs
echo. Hex view 2 is closed
rem this will wait
echo. PLEASE WAIT..............
CHOICE /N /C YN /T 40 /D Y >NUL
echo. Pdx is created
rem this will copy the pdx and place it in out folder
pushd %~dp0
start /b "" cscript MovePdx.vbs
echo. Moving pdx file to out folder....
rem this will wait
echo. PLEASE WAIT..............
CHOICE /N /C YN /T 3 /D Y >NUL
echo. File is moved to the out folder
rem this will close excel
pushd %~dp0
start /b "" cscript KillExcel.vbs
echo. PROCESS COMPLETE !
PAUSE
Last edited by
Squashman on 12 Feb 2017 22:09, edited 1 time in total.
Reason: MOD EDIT: Please use code tags.
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#2
Post
by Squashman » 12 Feb 2017 22:09
You don't need to use the START command. Just use cscript.exe directly. You can use the /WAIT option with the START command but in your case you don't even need to use the START command.
For future posts please do not post in all capital letters and please use code tags around your code.
-
shashank.gece
- Posts: 3
- Joined: 12 Feb 2017 19:49
#3
Post
by shashank.gece » 12 Feb 2017 22:24
So if I don't use (( start /b "" )) and directly use cscript, will the next command wait for the previous command to wait?
-
penpen
- Expert
- Posts: 2009
- Joined: 23 Jun 2013 06:15
- Location: Germany
#4
Post
by penpen » 13 Feb 2017 06:13
The batch interpreter nearly always processes one command after another.
The only exception is the pipe operator "cmd1 | cmd2", where cmd1 and cmd2 are running at the same time.
So the batch interpreter also fully processes the "start" command before executing the next command.
But the "start" command doesn't wait, except if you use the "/wait" switch.
(Beside this the "start" command also won't wait when using "/b".)
penpen
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#5
Post
by Squashman » 13 Feb 2017 07:37
shashank.gece wrote:So if I don't use (( start /b "" )) and directly use cscript, will the next command wait for the previous command to wait?
Yes. That is what I was inferring.