Jump to content

running various exe's and commands via batch file


ceez

Recommended Posts

hello everyone

here's what I am trying to run:

cls

echo off

ECHO INSTALLING ARCHICAD 11

"P:\CADD\_CAD Programs\AC 11 Install\AC11 USA 970.exe"

ECHO INSTALLING LIBRARY 11 INFORMATION

xcopy /e "P:\CAD Programs\AC 11 Install\ArchiCAD Library 11" "C:\Program Files\Graphisoft\ArchiCAD 11\ArchiCAD Library 11\" /Y

ECHO INSTALLING ARCHICAD 11 HOTFIX

"P:\CADD\_CAD Programs\AC 11 Install\AC11 1114\AC11-1114.exe"

ECHO INSTALLING ADDONS

xcopy "P:\CADD-Ops\Archicad\Add-ons\AC 11 Goodies" "C:\Program Files\Graphisoft\ArchiCAD 11\Add-Ons" /e /y

very simple process....the 1st line installs archicad from network drive (P:\), the 2nd line copies some files to local computer from P:\, the following installs a hotfix exe and the 4th line copies some other files locally.

what I need is for it to wait for the 1st command to run and finish before it goes and attempts the 2nd command and so forth. I know about the start /w switch but that is not working for me, it just opens a 2nd DOS box and nothing runs.

any ideas?

thanks!

:thumbup

Edited by ceez
Link to comment
Share on other sites


I know about the start /w switch but that is not working for me, it just opens a 2nd DOS box and nothing runs.
???

First, the two "xcopy" lines don't need "start /w", they'll function within the aforementioned ".bat/.cmd" file.

As for the two lines with EXE files to be executed, here is a sample for soporific's autopatcher that absolutely waits until execution completes (all over the place!) -

START /W "%LOC8%\%PARTH%\%FILES%" %ARGUS%

Naturally, there are variables (passed from .bat-to-.bat).

- loc8 = starting folder (control .bat files)

- parth = next lower folder (where the program is)

- files = program to execute

- argus = program arguments

So an example of how this should work for you is -

START /WAIT "P:\CADD\_CAD Programs\AC 11 Install\AC11 USA 970.exe"

Clueless as to why it shouldn't work (no extra DOS boxes, just executable display stuff)...

Link to comment
Share on other sites

submix for the reply.

this is what happens when i add the start /w to the first line:

I double click the batch file

the main window comes up which says "INSTALLING ARCHICAD 11"

then a 2nd window opens just pointing to the desktop folder of my profile with the blinking cursor "_"

the exe (AC11 USA 970.exe) never runs, I close that window and the first window tells me if i want to terminate the job, I say no and then it continues with the other file copies and the hotfix install exe.

it's quite odd, but just as you see it, i dont see a problem with it.....weird!!??? :(

i'll revisit the code again later!

thanks again!

ceez

:thumbup

Link to comment
Share on other sites

btw, submix or anyone else, anyone know the code so if they choose a wrong number or letter that it prompts the user to try again?

something like: if %var% not equal to ??? then output "wrong selection"

Link to comment
Share on other sites

If you don't see this as a waste of download, go to -

http://www.msfn.org/board/index.php?showtopic=80800

and download/install it (AutoPatcher)... in the "CODE" folder are a lot of ".BAT" modules you could use of examples of "how-to's". Yes, it installs anyway on a non-Win98SE OS (just won't run; it detects wrong OS). Copy the folder and sub-folders to elsewhere, then uninstall it (ADD/REMOVE; you got examples now).

WOOHOO! DOS-oriented scripts!!!

HTH

Edit - Forgot... also save the ".BAT" files in the "root" directory. Hope you have time to "read" all the code and understand it (for your purposes anyway). Could be you need to "CALL" a sub-BAT/CMD then do a START of the associated EXE within it... don't quite remember. Ennyhoo, just get it for great examples. ComputerHope also has a lot of info on everything you see in the "scripts".

Edited by submix8c
Link to comment
Share on other sites

264 megs of batch file examples?!?!
Ok... I did say you only needed the BAT files as examples, so if you want to "cancel" the download, attached are the BAT files in question... remember that variables point to different other folders/files within the package.

just_the_BAT.zip

Edited by submix8c
Link to comment
Share on other sites

btw, submix or anyone else, anyone know the code so if they choose a wrong number or letter that it prompts the user to try again?

something like: if %var% not equal to ??? then output "wrong selection"

choice command will help in it.

check for its syntax on how you can use it with if errorlevel = ... command for your use.

Link to comment
Share on other sites

So an example of how this should work for you is -

START /WAIT "P:\CADD\_CAD Programs\AC 11 Install\AC11 USA 970.exe"

The above will not work because the syntax in the first quotes is the Title of the DOS Windows. You need to change it to:

START "Installing Whatever" /wait "P:\CADD\_CAD Programs\AC 11 Install\AC11 USA 970.exe"

The syntax is:

start "Title of Windows" /wait "program to execute.exe"

This will solve the problem you mentioned in post #3 about two windows.

Edited by spacesurfer
Link to comment
Share on other sites

@spacesurfer -

WOOHOO! You are correct... The problem had lain in the usage of OLD style .BAT execution; this is obviously for 2K/XP/2Kn new-style .CMD execution. Yep, there's a difference (I had forgotten about). It works exactly like that. I assume that any executable parameters (following the .EXE, outside of quotes) will be passed (eg for "quiet" installs).

Ennyhoo, the examples given in the Win9x attachment still apply (kind of). Best to check the differences if you want to create a fancy script, since changes have been made to how they work.

BTW, the "title" appears to be irrelevant in this case, just a requirement of the syntax used (it doesn't do anything in this case - only relevant if starting another CMD/BAT window, not an EXE/COM)...

Edited by submix8c
Link to comment
Share on other sites

@everyone, thank you very much for your assistance, it's working PERFECTLY now!

@submix, thanks for the zip file with the batch files, I just clicked and figured it woudl be somwhere in that huge download...but you did save me

some bandwith! :)

@spacesurfer, thank you for the code syntax, I did not know about the " " (quotes).

@aadipa, I did find some info on the choices command but it seems to be a pre XP command. thanks!

thanks again!

ceez

:thumbup

Link to comment
Share on other sites

if you need to pause for ~4 seconds you can also use

echo pausing for 4 seconds before continuing...
ping 127.0.0.1 > nul
echo resuming...

or

echo pausing for 10 seconds before continuing...
ping 127.0.0.1 /n 10 > nul
echo resuming...

i have that in one batch for a plugin installer that doesnt close immediately after install and will error if i try to access it immediatly

Link to comment
Share on other sites

No... the "ping" has a "built-in wait time" that you can specify (in the second example "10 seconds"). The " > nul " only sends the "console output" to never-never land... Different ways to "stall", that was one of them...

Yes... in seconds, whatever value you want...

Edited by submix8c
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...