module CommandLineParser = module private NativeMethods = // Retrieves the command line as processed by the shell [<DllImport("kernel32.dll", CharSet = CharSet.Auto)>] extern System.IntPtr GetCommandLine(); // Remove the executable name (first token) from the command-line let ExtractCommandLineArgumentString() = let ptr = NativeMethods.GetCommandLine(); let commandLine = Marshal.PtrToStringAuto(ptr); let result = PSParser.Tokenize(commandLine) commandLine.Substring( (fst result).[0].EndColumn )