![](/img/trans.png)
[英]Accessing a file which is opened by another exe (opening properties of this file) from that exe's code
[英]Opening a .exe file from configurable path
我想知道如何在 C# 中打开一个程序,在任何计算机上,我只能从它开始
Process.Start("C:\Users\\*name*\Desktop\MxMV2\MxMV2 EA\EA\bin\Debug\EA.exe");
但是我想把这个程序分享给我的朋友,他们没有和我一样的文件目录。 那么我该怎么做呢?
您可以自由地不对桌面路径进行硬编码。
string desktoppath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
String path = @"MxMV2\MxMV2 EA\EA\bin\Debug\EA.exe";
Process.Start(desktoppath + @"\" + path);
这是你想要的吗?
您可以为此目的使用SpecialFolder枚举:
Process.Start($@"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}\MxMV2\MxMV2 EA\EA\bin\Debug\EA.exe");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.