I work under Linux, and run programs using shell scripts, with data
read directly out of the script, by using something like this
ifort bla.f90
../a.out << eoi
<data1>
<data2>
eoi
A colleague (who doesn't frequent news groups) works under Windows
and wants to do something similar. He already has a compiled
program, e.g. bla.exe and wants to know how to make the batch
process read data directly from the batch file, as my script
does. How is that done?
--
Dieter Britz (dieterhansbritz<at>gmail.com)
|
|
0
|
|
|
|
Reply
|
dieterhansbritz (43)
|
12/14/2011 2:11:06 PM |
|
On Wed, 14 Dec 2011 15:11:06 +0100, Dieter Britz wrote:
> I work under Linux, and run programs using shell scripts, with data
> read directly out of the script, by using something like this
>
> ifort bla.f90
> ./a.out << eoi
> <data1>
> <data2>
> eoi
>
> A colleague (who doesn't frequent news groups) works under Windows
> and wants to do something similar. He already has a compiled
> program, e.g. bla.exe and wants to know how to make the batch
> process read data directly from the batch file, as my script
> does. How is that done?
Under Windows the executable is usually given the name of the first
Fortran file, so it would be
bla <eoi
which would read data requested from the default terminal (usually unit 5;
I always use the * as my default terminal). To save default screen output,
try
bla <eoi >my-output.txt
We normally make sure that our files have an extension, so would have
bla <eoi.txt >my-output.txt
You would need to make sure that bla was compiled for command-line prompt
(Windows console) NOT QuickWin or Windows GUI.
|
|
0
|
|
|
|
Reply
|
none3 (1062)
|
12/14/2011 1:36:55 PM
|
|
On 2011-12-14 15:11, Dieter Britz wrote:
> I work under Linux, and run programs using shell scripts, with data
> read directly out of the script, by using something like this
>
> ifort bla.f90
> ./a.out << eoi
> <data1>
> <data2>
> eoi
>
> A colleague (who doesn't frequent news groups) works under Windows
> and wants to do something similar. He already has a compiled
> program, e.g. bla.exe and wants to know how to make the batch
> process read data directly from the batch file, as my script
> does. How is that done?
>
You can - at the very least - do that as follows:
- Put the data in a separate file, say "input"
- Then run the program like this:
program.exe < input
This will certainly work, but alternatives you might try is
a pipe:
cat input |program.exe
I do not think the <<label ... label trick works with Windows
batch files. (But then: MinGW provides a bash for Windows and
there is also a winbash ...)
Regards,
Arjen
|
|
0
|
|
|
|
Reply
|
arjen.markus895 (634)
|
12/14/2011 1:38:34 PM
|
|
|
2 Replies
93 Views
(page loaded in 0.043 seconds)
Similiar Articles: JButton and Execute Windows Batch File - comp.lang.java.help ...... batch mode - comp.soft-sys.matlab User-mode profiler in Windows - comp.lang.asm.x86 Batch mode. Run the ... run a 'script' in batch ... ansys in batch mode and input file ... JButton and Execute Windows Batch File - comp.lang.java.gui ...... batch mode - comp.soft-sys.matlab User-mode profiler in Windows - comp.lang.asm.x86 Batch mode. Run the ... run a 'script' in batch ... ansys in batch mode and input file ... Batch user create script - comp.unix.solarisHi. I need to add a load of users on some Solaris 9 servers. I used to have a script that took the input from a ascii file and created them for me... Append both standard output and standard error of command to file ...Batch files - Redirection - Rob van der Woude's Scripting Pages command >> file 2>&1 ... NT) commandA | commandB: Redirect standard output of commandA to standard input of ... Run Ansys Classic from Matlab - comp.soft-sys.matlab> if you still need help id go about it this way: > in your main function or script, write a matlab dos command which opens ansys in batch mode and input file is a txt ... Communication between server/client (sockets)! - comp.unix ...My server needs input like: "DO JOB BATCH FILE1 FILE 2", whats the best way to communicate, whats mainly used? Is this a good way, implement a parser server side and ... linker input file unused because linking not done -- compile error ...Hello evryone, I'm stock trting to install DBD-mysql-3.0002_5 on Solaris 9 sun 5.9, compiling with gcc 3.4.2 and perl 5.8.8 compiled with the same gcc... a unix script to send email notification when a sas batch job ...By redirection file #2 to the same place as file #1 (since ">" is shorthand ... then you just need to send this command, unmodified, into the standard input of the "batch ... EDK, XST & inouts - comp.arch.fpgaA batch file, synthesis.sh, has been created that allows you to synthesize those ... instead of just the one inout port, as if I had to use directly the > input ... Help on getting .h files for socket programming - comp.unix ...My server needs input like: "DO JOB BATCH FILE1 FILE ... Java Socket Programming: two-way communication between client and ... from earlier today, I have included code to ... Batch files - Ask For User Input - Rob van der Woude's Scripting PagesUser Input. Sometimes we need some user interaction in our batch files. We may need to know to which directory a file is to be copied, for example. Accepting Keyboard Input in Batch Files - Microsoft SupportThe MS-DOS batch language facility does not provide a means for you to provide input to control program flow. All information input from you must be ... 7/24/2012 5:56:09 PM
|