1

I am writing a batch file which will call an application(XYZ.exe) to update a firmware and then call other applications.

When called, the application XYZ.exe opens in a new console window, executes, then prompts user input. Once user provides input, it returns to the original console window and executes the rest.

I have two issues:

1) On exit, the application prompts user to "Press any key". The problem is I need it to exit without any user input. Is it possible to provide input from batch file. Note: This application runs in another console and batch file executes in another console

2) How can I redirect the output of the application. Note: application options > xxx.txt file does not works. I hope this is due to the application running in another console.

hazzelnuttie
  • 1,403
  • 1
  • 12
  • 22
  • 2
    Are you sure you are calling the executable directly? It sounds like you might be calling a batch script that launches the executable via START /WAIT, followed by PAUSE. – dbenham Mar 05 '13 at 13:27
  • 1
    I read this as you have a batch script which calls application xyz. The application xyz itself contains a pause at the end of its execution. Is this correct? – David Ruhmann Mar 05 '13 at 14:27
  • 2
    Perhaps you could post the relevant part of your batch file showing how you are calling xyz.exe. – Nate Hekman Mar 05 '13 at 16:56
  • 3
    If `> xxx.txt` doesn't work, then it is because the app isn't directing its output to STDOUT. If it is using STDERR, then you can capture that by using `> xxx.txt 2>&1`, which will send both STDOUT and STDERR to xxx.txt. If that doesn't capture it, then they are likely updating the console directly instead of using the standard I/O routines, in which case you won't be able to redirect the output with `>` or `2>&1`. – James L. Mar 05 '13 at 21:39
  • @dbenham I am not using any START script. echo *** flashtool.exe – hazzelnuttie Mar 06 '13 at 07:22
  • @DavidRuhmann Yes u r correct. I dont have with me the code of the application. I have with me only the executable. So I have no way of modifying the application... But think of ways in which i can use it – hazzelnuttie Mar 06 '13 at 07:23
  • @NateHekman I use it as : flashtool.exe – hazzelnuttie Mar 06 '13 at 07:24
  • @JamesL. I tried it. But it didn't helped either.. Thanks – hazzelnuttie Mar 06 '13 at 07:24
  • @DavidRuhmann u r the only one to understand my question... Please help me out – hazzelnuttie Mar 07 '13 at 06:21
  • 1
    @Manimehalai There is a methodology about piping `|` input into the program your calling. I believe this will work for you. See the answer in this post: http://stackoverflow.com/questions/13832786/how-do-i-send-commands-to-an-exe-running-through-the-command-line-with-batch However, you will have to 1. have it send everything to the program, even the user prompted stuff or 2. have it wait on a timer to send input to bypass the program's pause. – David Ruhmann Mar 07 '13 at 12:49

0 Answers0