1.

Solve : Runnig 2 batch file?

Answer»

Hello All,
There is an example of what I am try to ACHIEVE

I Created a test1.bat file. Inside that batch file added
-----------
echo off
cls
START C:\test2.bat
-----------

Now I created  test2.bat and added it to test1.bat
-----------
echo off
cls

echo.test 2 here..
pause
-----------

When I execute I see the test2.bat open due to the pause command. What I was try to achieve is the test2.bat should close on its own even though you have a pause command.
When you complete the action I see the command prompt still running. I need to close it once the execution is done.
Hope if any one could help me.

Thanks & Regards
Girish Katti
The pause command will wait for a key to be pressed to continue. I do not know the technical reasons, but it will cause the command window not to terminate or continue on until a key has been pressed.

If the window remains open even after the script has completed, try adding CMD /c between start and test.bat .Hi,
Adding CMD /C closes the window after the second batch file is executed. Is there any way we can close the batch file having a pause entry.
I to agree its virtually not possible to do but any work around.
If you want it to stay open, replace cmd /c with cmd /k.Hi,
What I exactly need was to close the batch file having a pause statement.
Presently we are calling the second batch file from the first batch file and while we execute the first the second still remains open due to the pause statement.
I need the second batch file to close when we execute the first one.

Thanks in advance.


Quote from: girishkatti123 on June 21, 2009, 10:22:26 PM

I need the second batch file to close when we execute the first one.
Thanks in advance.
That just won't work. Pause waits for a key to be pressed. If you want to wait for a specific time, try this. Replace xx with desired time in seconds.

PING localhost -n xx -w 1000 > nulThanks for all your inputs.
I will use the ping command and then send a enter keyword to the batch file.



Discussion

No Comment Found