.NET的Process.Start默认目录? [英] .NET Process.Start default directory?

查看:208
本文介绍了.NET的Process.Start默认目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从C# .NET 控制台应用程序内部发射了一个Java应用程序。它的工作原理罚款,其中Ja​​va应用程序不关心默认的目录是什么情况,但没有Java应用程序只搜索当前目录的支持文件。

I'm firing off a Java application from inside of a C# .NET console application. It works fine for the case where the Java application doesn't care what the "default" directory is, but fails for a Java application that only searches the current directory for support files.

是否有可以被设置为指定一个方法是在开始默认目录的处理参数α

Is there a process parameter that can be set to specify the default directory that a process is started in?

推荐答案

是的!
的ProcessStartInfo有一个叫做物业的工作目录的,只需使用:

...
using System.Diagnostics;
...

var startInfo = new ProcessStartInfo();

  startInfo.WorkingDirectory = // working directory
  // set additional properties 

Process proc = Process.Start(startInfo);

这篇关于.NET的Process.Start默认目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆