C# ProcessStartInfo:如何指定文件路径? [英] C# ProcessStartInfo: how to specify filepath?

查看:132
本文介绍了C# ProcessStartInfo:如何指定文件路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到在ProcessStartInfo中可以指定文件名,但是如何指定文件路径?

谢谢.

解决方案

当它说文件名"时,它表示文件的完整或相对路径.因此,您可以执行诸如 @"C:\program files\my folder\myProcess.exe"; 之类的操作.或者 @".\..\..\MyRelativePathedProcess.exe"; 你也可以通过 Process.StartInfo 的 WorkingDirectory 属性来控制 CWD.

I can see that in ProcessStartInfo you can specify a file name, but how do you specify a file path?

Thanks.

解决方案

When it says "filename" it means full or relative path to the file. So you could do something like @"C:\program files\my folder\myProcess.exe"; for example. Or @".\..\..\MyRelativePathedProcess.exe"; You can also control the CWD with Process.StartInfo's WorkingDirectory property.

这篇关于C# ProcessStartInfo:如何指定文件路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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