is this possible with bat file?

D

David

I have some login scripts that are simple batch files used mainly for
mapping network drives. I have a need to have a batch file start another
program but I don't want it to wait around for the program to exit or
return. (I don't want the batch file to block, in .net programming terms).

start program.. and then exit. Can I do this with standard batch file
(2000/xp machines) or do I need to use WSH and vbscript? I know I can with
vbscript but I don't want to convert all my files if I don't have to.
 
M

Mark V

I have some login scripts that are simple batch files used
mainly for mapping network drives. I have a need to have a batch
file start another program but I don't want it to wait around
for the program to exit or return. (I don't want the batch file
to block, in .net programming terms).

start program.. and then exit. Can I do this with standard batch
file (2000/xp machines) or do I need to use WSH and vbscript? I
know I can with vbscript but I don't want to convert all my
files if I don't have to.

C:\>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL |
/BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]

"title" Title to display in window title bar.
[snipped more]

START "" "<FQP to program executable>"
 
D

David

ah... thanks.

Mark V said:
I have some login scripts that are simple batch files used
mainly for mapping network drives. I have a need to have a batch
file start another program but I don't want it to wait around
for the program to exit or return. (I don't want the batch file
to block, in .net programming terms).

start program.. and then exit. Can I do this with standard batch
file (2000/xp machines) or do I need to use WSH and vbscript? I
know I can with vbscript but I don't want to convert all my
files if I don't have to.

C:\>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL |
/BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]

"title" Title to display in window title bar.
[snipped more]

START "" "<FQP to program executable>"
 
U

Urpiano Cedazo

You can launch a program in background ending its name with an ampersan

program.exe --> launched in foreground
program.exe& --> launched in background
 
D

David

really? nice. I know that has been a feature in linux but didn't know
windows supported it... when did windows start supporting this? does it work
for any non-gui program?

thanks for the info.
 
D

David

a couple follow up questions just occurred to me:

1) do you mean that the program will run on a background thread so that the
calling batch file will keep executing (basically, a way to launch another
process asynchronously)? or do you mean that the program is forced to run in
the background, as in its running but no interface/output is shown? (I'm
assuming its the first)

2) usage question: if the program is a command line program with parameters
should it be:
A) "program.exe& parameters"
or
B) "program.exe parameters &"

thanks again.
 
U

Urpiano Cedazo

Sorry, I was on another OS. You can try tu use start:

start cmd /c program options_and_parameters
or
start cmd /k program options_and_parameters
 
A

Al Dunbar

LOL, I thought so. in the on-topic o/s of this newsgroup the "&" character
is used to separate commands. Sticking one on the end of a command is like
saying, after doing this command, do a null command.

/Al
 
U

Urpiano Cedazo

Exactly

--
Un saludo
Urpiano Cedazo


Al Dunbar said:
LOL, I thought so. in the on-topic o/s of this newsgroup the "&" character
is used to separate commands. Sticking one on the end of a command is like
saying, after doing this command, do a null command.

/Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top