Skip to content
Prev 73697 / 398498 Next

Using system to run a stand alone program that requires input in Windows

Well, I'm confused because I tried to cook up an exaple and it appears
to work as I think it should. If I have a simple script named
myInput.bat:
@echo off
echo Enter y
set /p Input=
if /i "%Input%"=="y" (goto Proceed)
echo y not entered
exit /b
:Proceed
echo y entered

and a text file with just a y in it called y.txt then this works:
 > system("myInput < y.txt", show.output.on.console = T)
Enter y
y entered
 > 

So, I'm baffled.