Unity3D怎么打开应用程序

如题所述

第1个回答  2015-03-24
using System.Diagnostics;

private string filename = @"C://Start.exe";
private string s;

if (GUI.Button(new Rect(0, 50, 150, 50), "Start Start.exe"))
{
string[] args = new string[1];

StartProcess(filename, args);

}

public bool StartProcess(string filname, string[] args)
{
try
{
s = "Start";
Process myprocess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(filename, s);
myprocess.StartInfo = startInfo;
myprocess.StartInfo.UseShellExecute = false;
myprocess.Start();
return true;
}
catch (Exception ex)
{
UnityEngine.Debug.Log("出错原因:" + ex.Message);
}
return false;
}
相似回答