ND_SimulationAutomaticControl/Assets/Scripts/ExeLauncher.cs

25 lines
566 B
C#

using System.Diagnostics;
using System.IO;
using UnityEngine;
public class ExeLauncher : MonoBehaviour
{
void Start()
{
OpenExe("td2.bat");
}
void OpenExe(string pathname)
{
string batPath = Path.Combine(Application.streamingAssetsPath, pathname);
if (!File.Exists(batPath)) return;
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = batPath,
UseShellExecute = true,
WorkingDirectory = Path.GetDirectoryName(batPath)
};
Process.Start(psi);
}
}