PC Review


Reply
Thread Tools Rate Thread

Batch File Questions

 
 
Lushington
Guest
Posts: n/a
 
      1st Jul 2009

It's been a long time since I've done any batch programming and I need my
memory refreshed.

If I start two applications in sequence

@echo off
"C:\Program Files\My Application\My Program" /parameters
"C:\Program Files\Another App\Another Program" /parameters

Does the first program have to complete before the second one starts (which
is what I want)? Or do I have to be a little fancier?

A Command Prompt window opens when the batch file is executed. Is there a
way to close the Command Prompt window before the programs complete?
 
Reply With Quote
 
 
 
 
Kelly
Guest
Posts: n/a
 
      1st Jul 2009
Using Batch Files:
http://www.microsoft.com/resources/d....mspx?mfr=true

--

All the Best,
Kelly (MS-MVP/DTS&XP)

Taskbar Repair Tool Plus!
http://www.kellys-korner-xp.com/taskbarplus!.htm


"Lushington" <(E-Mail Removed)> wrote in message
news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
> It's been a long time since I've done any batch programming and I need my
> memory refreshed.
>
> If I start two applications in sequence
>
> @echo off
> "C:\Program Files\My Application\My Program" /parameters
> "C:\Program Files\Another App\Another Program" /parameters
>
> Does the first program have to complete before the second one starts
> (which
> is what I want)? Or do I have to be a little fancier?
>
> A Command Prompt window opens when the batch file is executed. Is there a
> way to close the Command Prompt window before the programs complete?


 
Reply With Quote
 
Guest
Posts: n/a
 
      1st Jul 2009

start "" /w Program1
start "" /w Program2

start /? for help
--
..
--
"Lushington" <(E-Mail Removed)> wrote in message
news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
> It's been a long time since I've done any batch programming and I need my
> memory refreshed.
>
> If I start two applications in sequence
>
> @echo off
> "C:\Program Files\My Application\My Program" /parameters
> "C:\Program Files\Another App\Another Program" /parameters
>
> Does the first program have to complete before the second one starts
> (which
> is what I want)? Or do I have to be a little fancier?
>
> A Command Prompt window opens when the batch file is executed. Is there a
> way to close the Command Prompt window before the programs complete?


 
Reply With Quote
 
Tim Meddick
Guest
Posts: n/a
 
      1st Jul 2009

Almost right, but use the "start" command to start the programs using
the "/w" (wait) switch if you really need the first program to finish
before starting the second, thus....

@echo off
start /w "C:\Program Files\My Application\My Program" /parameters
start /w "C:\Program Files\Another App\Another Program" /parameters


==

Cheers, Tim Meddick, Peckham, London. :-)




"Lushington" <(E-Mail Removed)> wrote in message
news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
> It's been a long time since I've done any batch programming and I need
> my
> memory refreshed.
>
> If I start two applications in sequence
>
> @echo off
> "C:\Program Files\My Application\My Program" /parameters
> "C:\Program Files\Another App\Another Program" /parameters
>
> Does the first program have to complete before the second one starts
> (which
> is what I want)? Or do I have to be a little fancier?
>
> A Command Prompt window opens when the batch file is executed. Is
> there a
> way to close the Command Prompt window before the programs complete?



 
Reply With Quote
 
Lushington
Guest
Posts: n/a
 
      1st Jul 2009
Thanks (and to Tim Meddick too). The help file just has /wait rather than /w
but that's a small point.

And I think if I use the /B parameter, it won't open a Command Prompt
window, either.

"." wrote:

> start "" /w Program1
> start "" /w Program2
>
> start /? for help
> --
> ..
> --
> "Lushington" <(E-Mail Removed)> wrote in message
> news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
> > It's been a long time since I've done any batch programming and I need my
> > memory refreshed.
> >
> > If I start two applications in sequence
> >
> > @echo off
> > "C:\Program Files\My Application\My Program" /parameters
> > "C:\Program Files\Another App\Another Program" /parameters
> >
> > Does the first program have to complete before the second one starts
> > (which
> > is what I want)? Or do I have to be a little fancier?
> >
> > A Command Prompt window opens when the batch file is executed. Is there a
> > way to close the Command Prompt window before the programs complete?

>
>

 
Reply With Quote
 
Tim Meddick
Guest
Posts: n/a
 
      1st Jul 2009
I use the "/b" switch always (just to be on the safe side) but I think
that it really only applies to 'Command-line' tools and Win16 DOS apps.

==

Cheers, Tim Meddick, Peckham, London. :-)




"Lushington" <(E-Mail Removed)> wrote in message
news:F3E0269E-7342-44AB-B2E0-(E-Mail Removed)...
> Thanks (and to Tim Meddick too). The help file just has /wait rather
> than /w
> but that's a small point.
>
> And I think if I use the /B parameter, it won't open a Command Prompt
> window, either.
>
> "." wrote:
>
>> start "" /w Program1
>> start "" /w Program2
>>
>> start /? for help
>> --
>> ..
>> --
>> "Lushington" <(E-Mail Removed)> wrote in message
>> news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
>> > It's been a long time since I've done any batch programming and I
>> > need my
>> > memory refreshed.
>> >
>> > If I start two applications in sequence
>> >
>> > @echo off
>> > "C:\Program Files\My Application\My Program" /parameters
>> > "C:\Program Files\Another App\Another Program" /parameters
>> >
>> > Does the first program have to complete before the second one
>> > starts
>> > (which
>> > is what I want)? Or do I have to be a little fancier?
>> >
>> > A Command Prompt window opens when the batch file is executed. Is
>> > there a
>> > way to close the Command Prompt window before the programs
>> > complete?

>>
>>



 
Reply With Quote
 
Lushington
Guest
Posts: n/a
 
      1st Jul 2009
Interestingly, another parameter for start is "title" which "Specifies the
title to display in Command Prompt window title bar." Even though this
parameter is supposedly optional, it seems that if the filename for the app
to be executed is enclosed in double quotes (as in my example, because of the
spaces in the path), then the start command uses the filename as the title,
doesn't find anything to execute, and completes without doing anything.

I had to use this syntax to get it to work:

start "mytitle" /wait "C:\Program Files\My Application\My Program" /parameters

and you're right, /B or no /B didn't seem to make a difference.

Start command syntax:
http://technet.microsoft.com/en-us/l.../bb491005.aspx

"Tim Meddick" wrote:

> I use the "/b" switch always (just to be on the safe side) but I think
> that it really only applies to 'Command-line' tools and Win16 DOS apps.
>
> ==
>
> Cheers, Tim Meddick, Peckham, London. :-)
>
>
>
>
> "Lushington" <(E-Mail Removed)> wrote in message
> news:F3E0269E-7342-44AB-B2E0-(E-Mail Removed)...
> > Thanks (and to Tim Meddick too). The help file just has /wait rather
> > than /w
> > but that's a small point.
> >
> > And I think if I use the /B parameter, it won't open a Command Prompt
> > window, either.
> >
> > "." wrote:
> >
> >> start "" /w Program1
> >> start "" /w Program2
> >>
> >> start /? for help
> >> --
> >> ..
> >> --
> >> "Lushington" <(E-Mail Removed)> wrote in message
> >> news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
> >> > It's been a long time since I've done any batch programming and I
> >> > need my
> >> > memory refreshed.
> >> >
> >> > If I start two applications in sequence
> >> >
> >> > @echo off
> >> > "C:\Program Files\My Application\My Program" /parameters
> >> > "C:\Program Files\Another App\Another Program" /parameters
> >> >
> >> > Does the first program have to complete before the second one
> >> > starts
> >> > (which
> >> > is what I want)? Or do I have to be a little fancier?
> >> >
> >> > A Command Prompt window opens when the batch file is executed. Is
> >> > there a
> >> > way to close the Command Prompt window before the programs
> >> > complete?
> >>
> >>

>
>
>

 
Reply With Quote
 
Tim Meddick
Guest
Posts: n/a
 
      1st Jul 2009

It's probably simpler to use the "TITLE" command in a batch file to set
the title, thusly :



@echo off
title My Program
start /w /b "C:\Program Files\My Application\My Program" /parameters



.....please note - there's no need for "quotes" after the 'title'
command.


==

Cheers, Tim Meddick, Peckham, London. :-)




"Lushington" <(E-Mail Removed)> wrote in message
news:44BE1C72-2178-4163-A571-(E-Mail Removed)...
> Interestingly, another parameter for start is "title" which "Specifies
> the
> title to display in Command Prompt window title bar." Even though this
> parameter is supposedly optional, it seems that if the filename for
> the app
> to be executed is enclosed in double quotes (as in my example, because
> of the
> spaces in the path), then the start command uses the filename as the
> title,
> doesn't find anything to execute, and completes without doing
> anything.
>
> I had to use this syntax to get it to work:
>
> start "mytitle" /wait "C:\Program Files\My Application\My Program"
> /parameters
>
> and you're right, /B or no /B didn't seem to make a difference.
>
> Start command syntax:
> http://technet.microsoft.com/en-us/l.../bb491005.aspx
>
> "Tim Meddick" wrote:
>
>> I use the "/b" switch always (just to be on the safe side) but I
>> think
>> that it really only applies to 'Command-line' tools and Win16 DOS
>> apps.
>>
>> ==
>>
>> Cheers, Tim Meddick, Peckham, London. :-)
>>
>>
>>
>>
>> "Lushington" <(E-Mail Removed)> wrote in message
>> news:F3E0269E-7342-44AB-B2E0-(E-Mail Removed)...
>> > Thanks (and to Tim Meddick too). The help file just has /wait
>> > rather
>> > than /w
>> > but that's a small point.
>> >
>> > And I think if I use the /B parameter, it won't open a Command
>> > Prompt
>> > window, either.
>> >
>> > "." wrote:
>> >
>> >> start "" /w Program1
>> >> start "" /w Program2
>> >>
>> >> start /? for help
>> >> --
>> >> ..
>> >> --
>> >> "Lushington" <(E-Mail Removed)> wrote in
>> >> message
>> >> news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
>> >> > It's been a long time since I've done any batch programming and
>> >> > I
>> >> > need my
>> >> > memory refreshed.
>> >> >
>> >> > If I start two applications in sequence
>> >> >
>> >> > @echo off
>> >> > "C:\Program Files\My Application\My Program" /parameters
>> >> > "C:\Program Files\Another App\Another Program" /parameters
>> >> >
>> >> > Does the first program have to complete before the second one
>> >> > starts
>> >> > (which
>> >> > is what I want)? Or do I have to be a little fancier?
>> >> >
>> >> > A Command Prompt window opens when the batch file is executed.
>> >> > Is
>> >> > there a
>> >> > way to close the Command Prompt window before the programs
>> >> > complete?
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
Guest
Posts: n/a
 
      1st Jul 2009
If putting the program in quotes you have to specify a title because the
first set of quotes is taken as the title.

--
..
--
"Tim Meddick" <(E-Mail Removed)> wrote in message
news:u492Oqe%(E-Mail Removed)...
> It's probably simpler to use the "TITLE" command in a batch file to set
> the title, thusly :
>
>
>
> @echo off
> title My Program
> start /w /b "C:\Program Files\My Application\My Program" /parameters
>
>
>
> ....please note - there's no need for "quotes" after the 'title' command.
>
>
> ==
>
> Cheers, Tim Meddick, Peckham, London. :-)
>
>
>
>
> "Lushington" <(E-Mail Removed)> wrote in message
> news:44BE1C72-2178-4163-A571-(E-Mail Removed)...
>> Interestingly, another parameter for start is "title" which "Specifies
>> the
>> title to display in Command Prompt window title bar." Even though this
>> parameter is supposedly optional, it seems that if the filename for the
>> app
>> to be executed is enclosed in double quotes (as in my example, because of
>> the
>> spaces in the path), then the start command uses the filename as the
>> title,
>> doesn't find anything to execute, and completes without doing anything.
>>
>> I had to use this syntax to get it to work:
>>
>> start "mytitle" /wait "C:\Program Files\My Application\My Program"
>> /parameters
>>
>> and you're right, /B or no /B didn't seem to make a difference.
>>
>> Start command syntax:
>> http://technet.microsoft.com/en-us/l.../bb491005.aspx
>>
>> "Tim Meddick" wrote:
>>
>>> I use the "/b" switch always (just to be on the safe side) but I think
>>> that it really only applies to 'Command-line' tools and Win16 DOS apps.
>>>
>>> ==
>>>
>>> Cheers, Tim Meddick, Peckham, London. :-)
>>>
>>>
>>>
>>>
>>> "Lushington" <(E-Mail Removed)> wrote in message
>>> news:F3E0269E-7342-44AB-B2E0-(E-Mail Removed)...
>>> > Thanks (and to Tim Meddick too). The help file just has /wait rather
>>> > than /w
>>> > but that's a small point.
>>> >
>>> > And I think if I use the /B parameter, it won't open a Command Prompt
>>> > window, either.
>>> >
>>> > "." wrote:
>>> >
>>> >> start "" /w Program1
>>> >> start "" /w Program2
>>> >>
>>> >> start /? for help
>>> >> --
>>> >> ..
>>> >> --
>>> >> "Lushington" <(E-Mail Removed)> wrote in message
>>> >> news:E4484895-A1D2-4FA2-9CF7-(E-Mail Removed)...
>>> >> > It's been a long time since I've done any batch programming and I
>>> >> > need my
>>> >> > memory refreshed.
>>> >> >
>>> >> > If I start two applications in sequence
>>> >> >
>>> >> > @echo off
>>> >> > "C:\Program Files\My Application\My Program" /parameters
>>> >> > "C:\Program Files\Another App\Another Program" /parameters
>>> >> >
>>> >> > Does the first program have to complete before the second one
>>> >> > starts
>>> >> > (which
>>> >> > is what I want)? Or do I have to be a little fancier?
>>> >> >
>>> >> > A Command Prompt window opens when the batch file is executed. Is
>>> >> > there a
>>> >> > way to close the Command Prompt window before the programs
>>> >> > complete?
>>> >>
>>> >>
>>>
>>>
>>>

>
>


 
Reply With Quote
 
Terry R.
Guest
Posts: n/a
 
      1st Jul 2009
The date and time was Tuesday, June 30, 2009 7:33:59 PM, and on a whim,
pounded out on the keyboard:

> If putting the program in quotes you have to specify a title because the
> first set of quotes is taken as the title.
>


You don't have to "specify" a title. Just add an extra set of quotes.
start "" /wait "C:\Program Files\My Application\My Program" /parameters


Terry R.
--
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simple Batch File questions WickedShark Microsoft Windows 2000 CMD Promt 12 16th Dec 2009 06:55 AM
A script/batch to kill a batch file from scheduled tasks? Bogdan Windows XP Configuration 1 31st Jul 2009 06:05 AM
batch file call from a macro - how ? and required batch format VB-rookie Microsoft Excel Programming 3 5th Sep 2008 10:33 PM
calling multiple batch files from within a batch file yawnmoth Windows XP General 3 26th May 2008 06:47 PM
Save batch window msgs to a file from the batch prog Stephen Rainey Windows XP General 3 10th Jan 2007 12:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:18 PM.