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.?

4
  • 1
    Why are you using prompt.exe ? prompt is an internal command. Please explain the task a little more. Commented Apr 29, 2014 at 12:26
  • by using prompt.exe and output of print, i am doing some other calculation. Okay i will rename it. Commented Apr 29, 2014 at 12:29
  • possible duplicate of Windows batch files: How to set a variable with the result of a command? Commented Apr 29, 2014 at 12:35
  • No. result of kernel command is working fine. Result of exe file is not working. Thats why i raised this. Commented Apr 29, 2014 at 12:54

1 Answer 1

3

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%
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.