DosTips.com

A Forum all about DOS Batch
It is currently 26 May 2017 18:23

All times are UTC-06:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 12 Feb 2017 20:30 
Offline

Joined: 12 Feb 2017 19:49
Posts: 3
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.
MOD EDIT: Please use code tags.


Top
   
PostPosted: 12 Feb 2017 22:09 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3505
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.


Top
   
PostPosted: 12 Feb 2017 22:24 
Offline

Joined: 12 Feb 2017 19:49
Posts: 3
So if I don't use (( start /b "" )) and directly use cscript, will the next command wait for the previous command to wait?


Top
   
PostPosted: 13 Feb 2017 06:13 
Offline

Joined: 23 Jun 2013 06:15
Posts: 1318
Location: Germany
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


Top
   
PostPosted: 13 Feb 2017 07:37 
Offline
Expert

Joined: 23 Dec 2011 13:59
Posts: 3505
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.


Top
   
PostPosted: 13 Feb 2017 17:41 
Offline

Joined: 12 Feb 2017 19:49
Posts: 3
Thanks !!
It worked ....


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited