?
Solved

Another Batch /wait Question.

Posted on 2004-11-12
13
Medium Priority
?
3,705 Views
Last Modified: 2008-01-09
I have looked around these forums for a while no and have not seen a solid reliable way to get a batch file to wait for an Win32 application to complete its setup before continuing.

For those who have used sleep.exe; This is where my batch craps out..

cls
ECHO Applying Security Settings for Domain PC's
ECHO Please Wait...
call .\INSTALL-DATA\Domain\addusers.exe /c .\INSTALL-DATA\Domain\AddToGroup.txt
ECHO.
ECHO.
ECHO Installing Netop for Domain Users.
ECHO Please Wait...
.\INSTALL-DATA\Domain\Netop-Domain.exe
.\INSTALL-DATA\sleep\sleep.exe 180
ECHO.
ECHO.
ECHO.
ECHO Installing Symantec Antivirus.
ECHO Please Wait...
.\INSTALL-DATA\setup.exe
.\INSTALL-DATA\sleep\sleep.exe 180
ECHO.
ECHO.
ECHO.

When the netop-domain.exe runs the winzip expands the files but then dies instantly when the sleep.exe program executes. The sleep app does its job and sits for 3 minutes but you can watch in task manager and the netop-domain.exe is not running.

I need suggestions for this and please do not post unless you have experience with this issue.


Also, I know Call commands will wait on scripts to finish, but they do not work with Win32 apps. Might there be a way to Call a .VBS and is there a VBS script that will execute the dos command and wait for it to finish? Will the batch wait on the vbs to complete?
0
Comment
Question by:erikcook
13 Comments
 
LVL 5

Expert Comment

by:dgroscost
ID: 12565119
Try using:

%SYSTEMROOT%\SYSTEM32\CMD.EXE /C START /WAIT .\INSTALL-DATA\Domain\Netop-Domain.exe

or

START /WAIT .\INSTALL-DATA\Domain\Netop-Domain.exe

0
 

Author Comment

by:erikcook
ID: 12565159
I tried this one as well.

start /wait produces an invalid switch error message.
0
 

Author Comment

by:erikcook
ID: 12565171
Might seem backwards, but


start /wait produces bad switch error and
start command /wait  kills the process after winzip extracts
0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 
LVL 5

Expert Comment

by:dgroscost
ID: 12565179
Invalid error?

What is this netop program?  Can you run it manually?

Why are you using .\ in front of the EXE name?

Can you try START /WAIT C:\blahblah\NetOp-Domain.exe ?

0
 

Author Comment

by:erikcook
ID: 12565324
Please read above.

start /wait produces "bad switch" error and
start command.exe /wait  kills the process after winzip extracts

./ indicating current directory
0
 
LVL 5

Expert Comment

by:dgroscost
ID: 12565406
I've never had such issues (with /start) and I've automated everything underneith the sun.

What is this NetOp-Domain program?  Something you or your company has written?  Perhaps we can look into what that program is doing and find another way...

0
 
LVL 51

Expert Comment

by:Netman66
ID: 12565451
Well, my 2 cents..

Batch commands are running from a 16-bit emulation - I've never had any luck trying to get these things to wait.

Are you comfortable running these commands from VBS?  VB Script will wait properly, but I am not a skilled programmer to lend you the answer.  Maybe another Expert that is experieinced at VB could jump in here.

0
 

Author Comment

by:erikcook
ID: 12565472
Its a winzip self extractor that extracts the data from the exe into a temp directory and launches a silent install.


Here is something that might help with my question.

I setup a small batch as a test with just the following in it.

START /WAIT C:\Netop-Domain.exe
PAUSE

I ran this batch on 2 different machines. 1 Windows 2000 SP4 and (2) Windows 2000 SP1

It works on the SP4 machine but not the SP1 machine.

This script must be run on SP1 machines. Is there possibly some kind of registry hack you can do via batch that fixes this problem?
0
 
LVL 5

Expert Comment

by:dgroscost
ID: 12565482
I guess my first question is, does the NetOp-Domain actually complete the installation on the SP1 machine??  (manual run)

0
 

Author Comment

by:erikcook
ID: 12565530
Yes.
0
 
LVL 5

Accepted Solution

by:
dgroscost earned 2000 total points
ID: 12565599
You could use Windows Scripting and create a .WSH file...

Try something along the lines of this...
Replace notepad with the NetOp filename.

<package>
      <job id="vbs">
            <script language="VBScript">
                  set WshShell = WScript.CreateObject("WScript.Shell")
                                                Return = WshShell.Run("C:\path\notepad.exe")
                  WScript.Sleep 180
            </script>
      </job>
</package>


Put that in a file, and run <filename>.wsh -- you'll need Windows Scripting but I believe Win2000 provides that.
0
 
LVL 85

Expert Comment

by:oBdA
ID: 12565999
Try
start "NetOp Installation" /wait C:\Netop-Domain.exe
According to the help, the "Title" argument is optional, but it actually isn't; it especially isn't when you use quotes around the program name.
0
 
LVL 5

Expert Comment

by:dgroscost
ID: 12607961
Did that work out for you?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Most folks would know the basics of how Dropbox works, so that’s not the purpose of this article. Security is what it’s all about, so here I’ll share how I choose to secure my Dropbox Account and the Data it contains.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question