0

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.

SdSdsdsd
  • 123
  • 10

3 Answers3

1

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%
Community
  • 1
  • 1
merlin2011
  • 71,677
  • 44
  • 195
  • 329
0

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

automatic
  • 2,727
  • 3
  • 34
  • 31
0

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.

Harry Johnston
  • 35,639
  • 6
  • 68
  • 158