This is my code so far:
FOR /f %%G IN (temp.file) DO (
echo %%G > temp
first_char.exe temp > letter
set /p myLetter =<letter
echo %myLetter%
)
first_char.exe prints to the stdout the first char from the input file.
It prints:
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
(because I have 6 lines of text in temp.file).
I can’t see why you need a
first_charexe file to extract a single char, a simplevar:~0,1should also work.Your
ECHO is off.problem is a problem of the expansion time of%myLetter%.It’s expanded when the complete parenthesis block is parsed, at this time
myLetter%is empty, therefor you got only empty lines.