cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
girishkatti123
Level 7

Executing a Batch file

Hi All,
I have a batch file which contents a pause command at the end of it. I used LauchAppAndWait to execute it but the batch just stays and does not close. I do know it's due to the pause command within the bacth file.
Is there any other command to launch the batch file and close on its own.

Thanks & Regards
Girish Katti
Labels (1)
0 Kudos
7 Replies
gprasadholla
Level 4

If you have a pause in batch file, it will wait for user input in all the cases. Even if its called from LauchAPP. Better would be is to remove it.

Other workaround would be to call lauch app with window status hidden. Now CMD will be running and will not be shown and once the installer is finished doing his work and exe goes down, even the cmd will go down.
0 Kudos
girishkatti123
Level 7

Thanks for the reply.
The installer will not continue untill the user closes the batch. I have 4 more batch files to be executed. I do know removing the pause command would work.
Any other work around to be done.

Thanks & Regards
Girish Katti
0 Kudos
gavin_landon
Level 6

You could use a batch wrapper. There is the "start" command that can be used for Windows machines.

Example:
Create a test1.bat file. Inside that batch file put:
-----------
@echo off
cls
start C:\test2.bat
-----------

Now create a test2.bat and put this inside it
-----------
@echo off
cls

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

Test1.bat will execute Test2.bat without waiting and exit allowing the installer to continue.

Hope that helps.
0 Kudos
girishkatti123
Level 7

Hi,
Thanks for the reply.
I did try executing the example as posted.
When you executed the test1.bat, test2.bat execute's but wait for user to close the it.
Is there any other workround where we could close the batch having a pause.
I could remove the pause but I have been instructed to not to edit the source files.
any workaround!!

Thanks & Regards
Girish Katti
0 Kudos
gavin_landon
Level 6

You could try:

nHwnd = FindWindow ("NotePad", "");
if (nHwnd != NULL) then
SendMessage (nHwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
endif;
0 Kudos
girishkatti123
Level 7

hi,
Is it possible to send Enter Key Stroke message to the batch file having a pause.
I find the onlt difficulty when to get the enter key stroke to be passed in.
The way we do in Vb script

WshShell.SendKeys "{ENTER}"

Can we do the same using IS2009.
0 Kudos
girishkatti123
Level 7

Hi,
How can I get the handle for a command prompt window using FindWindow option.
I am using hWnd = FindWindow("cmd","");
This always returns 0.

Thanks & Regards
Girish Katti
0 Kudos