/WAIT parameter not working?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Computer TechEZ
Posts: 5
Joined: 16 Jun 2010 19:50

/WAIT parameter not working?

#1 Post by Computer TechEZ » 16 Jun 2010 19:56

Here is the batch file...

----------------
@ECHO OFF
START "Launch TrueCrypt" /Dc:.\ /WAIT .\TrueCrypt.exe /Volume ComputerTechEZ /letter s /quit
START "Launch OC" /Ds:\OpenContactsPortable /WAIT s:\OpenContactsPortable\OpenContacts.exe

START "Dismount All TrueCrypt" /WAIT /B /Dc:.\ /WAIT TrueCrypt.exe /dismount s

ECHO Dismount completed successfully.
----------------

What I am trying to get it to do...
1. Launch TrueCrypt and mount the file ComputerTechEZ to drive S:
2. Then launches OpenContacts.exe which is within the drive
3. When OpenContacts.exe closes(which is done manually by the user at will) truecrypt then dismounts drive S:.

The problem is that TrueCrypt attempts to dismount right after OpenContacts.exe launches and does not wait. What am I doing wrong with the wait command?

amel27
Expert
Posts: 177
Joined: 04 Jun 2010 20:05
Location: Russia

Re: /WAIT parameter not working?

#2 Post by amel27 » 16 Jun 2010 23:17

Computer TechEZ wrote:The problem is that TrueCrypt attempts to dismount right after OpenContacts.exe launches and does not wait.
is pause occur before OpenContacts closed?

Code: Select all

TrueCrypt.exe /v ComputerTechEZ /l S /q
start "" /DS:\OpenContactsPortable /B /WAIT S:\OpenContactsPortable\OpenContacts.exe

pause
TrueCrypt.exe /d S /q

Computer TechEZ
Posts: 5
Joined: 16 Jun 2010 19:50

Re: /WAIT parameter not working?

#3 Post by Computer TechEZ » 17 Jun 2010 00:09

If I do

Code: Select all

pause
TrueCrypt.exe /d S /q


than truecrypt does not dismount until I press a key at the command window. I tried testing this code on Notepad.exe in place of OpenContacts.exe and the /WAIT command works. So for some reason using OpenContacts.exe with a /WAIT command does not actually wait. Why would that be?

amel27
Expert
Posts: 177
Joined: 04 Jun 2010 20:05
Location: Russia

Re: /WAIT parameter not working?

#4 Post by amel27 » 17 Jun 2010 01:10

Computer TechEZ wrote:than truecrypt does not dismount until I press a key at the command window
promt for pressing any key occur immediately after starting OpenContacts ?..

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: /WAIT parameter not working?

#5 Post by alan_b » 17 Jun 2010 13:27

Computer TechEZ wrote:I tried testing this code on Notepad.exe in place of OpenContacts.exe and the /WAIT ...


Perhaps you are comparing Apples with Oranges !

If you issue the command "START /?" you get lots of obscure information.
"START /WAIT ...." is very much a "maybe does" / "may does NOT" sort of thing,
depending upon
"If Command Extensions are enabled"; and
"When executing an application that is a 32-bit GUI application"

It gives me a headache trying to predict what happens.
I have experience of different consequences between invoking My_Program as
START /WAIT My_Program
or
My_Program

Sometimes it suits my needs better with "START /WAIT", and sometimes without.

Regards
Alan

Below are a few POSSIBLY relevant snippets from "START /?" :-

command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.

If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.

If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:

When executing an application that is a 32-bit GUI application, CMD.EXE
does not wait for the application to terminate before returning to
the command prompt. This new behavior does NOT occur if executing
within a command script.

Post Reply