How to read command line arguements
-
Wednesday, January 02, 2013 12:11 AM
I found this code somewhere (I lost the URL) and I would like to make it work for both fsi.exe and fsc.exe. It seems to work OK for fsi.exe. How can I make to work for fsc.exe too?
let argv = #if INTERACTIVE fsi.CommandLineArgs #else Sys.argv #endif
I keep getting errors from fsc.exe when I try to compile it. Where is this magical array Sys.argv defined?
Also: is there a command line argument for fsi that will make it execute a file with the extension of .fs or do I have to rename it to have an extension of .fsx?
siegfried heintze
All Replies
-
Wednesday, January 02, 2013 9:04 AM
The following code worked for me to read the command lines argument for fsc.exe.
let ary = System.Environment.GetCommandLineArgs() Array.iter (printf "%s ") ary
You may also check this link which explains in detail for your question.
Differences Between the Interactive, Scripting and Compiled Environments

