Question

In one directory I have two files:

'program.exe' and 'content.in'

How do I start 'program.exe' with the content of 'content.in' as an argument from the command-line in windows ?

Thanks.

Was it helpful?

Solution 2

If 'program.exe' accepts input from standard in you would

program.exe < content.in

If it doesn't then you are dependent on the program processing files through command arguments, potentially like

program.exe content.in

or

program.exe -i content.in

OTHER TIPS

You can also accomplish this by putting the contents of the file into a variable, borrowing the second half of this answer.

set /p VV=<content.in
program.exe %VV%

You probably want

for /F "tokens=*" %i in ('content.in') do program.exe %i

(In a batch file, replace %i with %%i.)

Note that if content.in contains more than one line of text, program.exe will be run multiple times, once for each line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top