Question

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

Was it helpful?

Solution

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%
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top