Calling a bat within a bat

View: New views
3 Messages — Rating Filter:   Alert me  

Calling a bat within a bat

by Gary Kuznitz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have a small problem that I would like to solve.  I have a bat file that has
this line in it:
Start "" /belownormal /wait C:\Batch\CleanTemp.bat

The original bat file opens a cmd window that stays open.  (That's good)
The line opens another cmd window and it runs.  When it's done running I have
to close the second window for the first window to continue.

I would like to either run the line in the first window so it will continue
when it finishes or find a way to close the second window automatically when it
finishes.

Thank you,

Gary Kuznitz

Re: Calling a bat within a bat

by foxidrive-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 19 Jun 2008 13:36:27 -0700, "Gary Kuznitz" <docfxit@...>
wrote:

>I have a small problem that I would like to solve.  I have a bat file that has
>this line in it:
>Start "" /belownormal /wait C:\Batch\CleanTemp.bat
>
>The original bat file opens a cmd window that stays open.  (That's good)
>The line opens another cmd window and it runs.  When it's done running I have
>to close the second window for the first window to continue.

Add an EXIT command as the last command in the batch file.

>I would like to either run the line in the first window so it will continue
>when it finishes or find a way to close the second window automatically when it
>finishes.

Re: Calling a bat within a bat

by giskier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can either add an exit command as the last line of the batch file as suggested.  This may not be the most elegant solution since it will close the command window when running under other circumstances.  This may be undesirable.  I like better the following solution:

start "" /belownormal /wait cmd.exe /C c:\batch\cleantemp.bat

Why do you need to open a new window?   If you don't you can just do "cmd.exe /C c...etc".  If you don't need another command window, you could simply do call c:\batch\cleantemp.bat.   In this last case it would not run in belownormal priority.

Hope this helps.

GISkier.

Gary Kuznitz wrote:
Hi,

I have a small problem that I would like to solve.  I have a bat file that has
this line in it:
Start "" /belownormal /wait C:\Batch\CleanTemp.bat

The original bat file opens a cmd window that stays open.  (That's good)
The line opens another cmd window and it runs.  When it's done running I have
to close the second window for the first window to continue.

I would like to either run the line in the first window so it will continue
when it finishes or find a way to close the second window automatically when it
finishes.

Thank you,

Gary Kuznitz