Writing an exe file to a batch file

I have an exe that will have Output values ​​as 0/1. EXE is called through a batch file. I want the batch file to run the EXE and write the result. How is this possible? Any help would be appreciated.

+3
source share
3 answers

I assume that you want to capture the output of the EXE and process this value, and not just print this value. Here's how you can capture the output in a variable:

FOR /F "tokens=*" %%i IN ('%~dp0sometool.exe') DO SET TOOLOUTPUT=%%i 
+3
source

You need the / F extension for the FOR loop.

for /F "tokens=*" %%i in ('call testing.exe') DO echo %%i
0
source

exe ? ? , > → .

:

C:\>dir >> dir.txt

dir.

" > " , " → " , .

0

Source: https://habr.com/ru/post/1785525/


All Articles