开发者

C# Process.Start Passing Arguments recursively

I have thi开发者_运维问答s use case in which I have to run

ikvm.exe -jar XXX.jar,

where XXX.jar takes the string args as argument.

So how do I invoke Process.Start so that I can accomplish this.

Simply typing ikvm.exe -jar XXX.jar args does not work.


using (Process process = new Process())
{
    process.StartInfo.FileName = "ikvm.exe";
    process.StartInfo.Arguments = "-jar XXX.jar";
    process.Start();
    process.WaitForExit();
    ...
}

Was this what you wanted?


You need to call Process.Start() and pass it a ProcessStartInfo object with the command arguments An example is below from here http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx

        ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
        startInfo.WindowStyle = ProcessWindowStyle.Minimized;

        Process.Start(startInfo);

        startInfo.Arguments = "www.northwindtraders.com";

        Process.Start(startInfo);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜