Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Origin of <file.tmp to pass input parameters

  1. May 31, 2013 #1
    I was just curious. I have a program that asks for input file name and output name when the console is executed. I needed to run it and automatically pass these file names. I found a way..

    test.exe <files.tmp

    where files.tmp has 2 lines. First line is name of input file, second is output file.

    It works, and the exe runs without asking for file names. I tried it on several of my FORTRAN console exes and it works! It will pass whatever the exe asks for input.

    Where does this come from? I was thinking unix, but it works in windows.
    Any ideas?

  2. jcsd
  3. May 31, 2013 #2


    Staff: Mentor

    It works because the concept of input redirection works in both Unix (or Linux) and Windows. The < character on the command line means "take input from this file instead of the console (keyboard)."

    Similarly, the > character redirects output from the usual output device (the monitor) to whatever file appears following this character.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook