I try to run f# script using fsi.exe via batch file
CALL "path\fsi.exe" --quiet --exec --use:"path\FindAndDelete.fsx" arg1 arg2 arg3
I need my script program operate with arg1 arg2 and arg3. But the command:
for arg in Environment.GetCommandLineArgs() do
printfn "%s" arg
prints all the parameters and say that arg1 is wrong parameter,but I need to operate only with arg1, arg2,arg3 in my script. Although what is the best way to run f# script with parameters and operate with them?
I personally use fsi.CommandLineArgs. The 0th argument is the filename so you can use Array.tail to get the args.
Alternatively if you do decide to use GetCommandLineArgs() it looks like the first argument is the 4th element in the list, aka args.[3]
outputs