I have a program that passes command-line arguments to an associated file (i.e. associated file extension) of an executable. The executable never receives the arguments. However, if I start the executable directly and pass it both the path to the associated file and the arguments, then it receives both the file path and the arguments.
- Operating System: Windows XP
- Programming Language: C#
I am starting the associated file using:
System.Diagnostics.Process.Start(filepath, arguments)
Thanks in advance for all assistance.
-EDIT
Basically, I have a programming language interpreter that needs to receive command-line arguments passed to it by a C# program.
If I start a code file using the C# program, the interpreter will start, but not receive the command-line arguments that were passed to the code file by the C# program.
So there are a total of three files:
- the interpreter
- the code file
- the program trying to start the code file as though it were a program
Also, starting the interpreter directly is not an option, because it is not located at the same file path on every computer.
I hope this is clearer, but I cannot post the source code do to legal restrictions.
You could try
(untested)changing the file association (on the advanced pane) to include %2 %3 etc in the arguments (normally it just includes %1) – however, this involves changes at the client, and (more importantly) the entire idea of passing arguments to a document presumes that you have the same viewer (i.e. that the arguments are sensible).IMO, a better option is to explicitly launch the exe, passing the doc (and the other others) as arguments.
Example:
receiver exe (just shows the command arguments received):
Then: created a “foo.flibble” file, right-click/open and associate with my receiver; went into file associations, “flibble”, advanced, “open”, edit, and added %2 %3 %4
Then in a separate exe:
Which shows:
So this has now passed the extra arguments to the exe via the document. But a lot of client configuration!