0

I have execution file (print.exe) which will print some numbers.I want to use those numbers. For that I wrote a batch file.

build.bat

set a=print.exe

FOR %I IN a DO prompt.exe %I%

I used the above 2 lines. But its not working. If, it is kernel command, the first line is working. For exe, it didn't work. How can i store the print.exe file output to variable.?

Muthupandi
  • 109
  • 3
  • 11
  • 1
    Why are you using prompt.exe ? prompt is an internal command. Please explain the task a little more. – foxidrive Apr 29 '14 at 12:26
  • by using prompt.exe and output of print, i am doing some other calculation. Okay i will rename it. – Muthupandi Apr 29 '14 at 12:29
  • possible duplicate of [Windows batch files: How to set a variable with the result of a command?](http://stackoverflow.com/questions/889518/windows-batch-files-how-to-set-a-variable-with-the-result-of-a-command) – wmz Apr 29 '14 at 12:35
  • No. result of kernel command is working fine. Result of exe file is not working. Thats why i raised this. – Muthupandi Apr 29 '14 at 12:54

1 Answers1

2

The Batch file below execute print.exe and get its output in numbers variable:

@echo off

for /F "delims=" %%a in ('print.exe') do set numbers=%%a

echo Output of print.exe is: %numbers%
Aacini
  • 65,180
  • 12
  • 72
  • 108