Process.Start - Pass html code to exe as argument

Posted by dkirk on Stack Overflow See other posts from Stack Overflow or by dkirk
Published on 2010-04-09T21:24:39Z Indexed on 2010/04/09 22:43 UTC
Read the original article Hit count: 384

Filed under:
|

Hello, I am using the code below to start a executable file from a windows service and I need to pass html code (stored in a variable) as an argument. I am escaping with double quotes but this is not working. What do I need to do in order to pass this correctly? Thanks in advance for any guidance that is offered.

Inside the service:

Process.Start(@"E:\Program Files\MyApp.exe", dr["rec"].ToString() +
                                  " \"" + subject + "\" \"" + htmlVar);

and then within MyApp.exe:

static void Main(string[] args)
{
    Program MyProg = new Program();
    MyProg.MyMeth(args[0].ToString(), args[1].ToString(), args[2].ToString());
}

© Stack Overflow or respective owner

Related posts about argument-passing

Related posts about c#