c# - Is it possible to pass command-line arguments to an executable via an associated file? -


I have a program that passes command line arguments in an associated file (i.e. related file extension) of an executable file is. Executable never receives logic However, if I start directly executable and pass it to the path of both the related file and the logic, then this file receives both path and logic.

  • Operating System: Windows XP
  • Programming Language: C #

I'm starting using the related file: < / P>

  System.Diagnostics.Process.Start (file path, logic)  

Thanks in advance for all assistance.

- EDIT

Actually, I have a programming language interpreter that needs to get command line arguments passed by the C # program.

If I start a code file using the C # program, the interpreter will start, but the C # program will not get the command line arguments passed to the code file.

Therefore there are three files:

  1. Interpreter
  2. Code file
  3. The program is trying to start the code file As it was a program

In addition, there is no OPT to start the interpreter directly, because it is not located on the same file path on every computer.

I hope this is clear, but I can not post the source code in legal restrictions.

You change the file association (on the advanced panel) ( Untested) to include% 2% 3 in the arguments (usually only contains% 1) - However, it involves a change on the client, and (more importantly) a document < / Em> The full idea of ​​passing the arguments is that you have the same viewer (i.e.

example:

For example:

< P> Example:

IMO, a better option Passing the DEC (and others) as a logic, the exe is to launch.>

receiver exe (just shows the received command argument):

  Fixed class Program {{System.STAThread} static zero main (string [] args) {System.Windows.Forms MessageBox.Show (string.Join ("|", Args));}}  

Then: create a "foo.flibble" file, right-click / open and associate with my receiver; file went into association, "flabby", advanced, "open", edit, and% 2% 3% 4 Added

F In a separate exe:

  start the process (@ "c: \ foo.flibble", "Argus test");  

which shows:

  c: \ foo.flibble | Test | Of | Args  

Then it is now given extra arguments to the exe through the document but too many client configurations!


Comments