[英]Run a command line process from unity
I am trying to run an external .exe file with argument from unity, this what I have been doing: 我正在尝试使用统一参数运行外部.exe文件,这就是我一直在做的事情:
ProcessStartInfo startInfo = new ProcessStartInfo("AAA.exe");
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.Arguments = "MyArgument";
Process.Start(startInfo);
But an error keeps telling me that unity couldn't find the executable file. 但是错误不断告诉我,统一找不到可执行文件。 How can I add a path or make unity find the executable file? 如何添加路径或统一查找可执行文件? Advance Thanks. 提前谢谢。
It appears you may be giving an incorrect Path to your .exe 看来您输入的.exe路径可能不正确
Try something like this: 尝试这样的事情:
string fullPath = Path.Combine(Environment.CurrentDirectory, "/YourSubDirectory/yourprogram.exe");
ProcessStartInfo startInfo = new ProcessStartInfo(fullPath);
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.Arguments = "MyArgument";
Process.Start(startInfo);
Application Paths in Unity - Dependent on where your .exe is based, this may be of use. Unity中的应用程序路径 -可能取决于您的.exe所在位置。
好了,您可能需要使用相对于您的统一build.exe文件夹的路径才能使其正常工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.