Execute An Exe From Code

Can I run an executable file (.exe) via script from within Unity game / application? I’m using UnityScript with Unity Free.

System.Diagnostics

Here’s an example in C#. In this example, I start Chrome and Navigate to google.com.

using UnityEngine;
using System.Collections;
using System.Diagnostics;
 
public class Example : MonoBehaviour 
{
	void Awake()
	{
		Process.Start ("Chrome.exe", "http://www.google.com");	
	}
}

Here’s one way to do it in Javascript (Unityscript):

#pragma strict

import System.Diagnostics;

var process : Process;

function Start () 
{
	process = new System.Diagnostics.Process();
	process.StartInfo.FileName = "Chrome.exe";
	process.StartInfo.Arguments = "http://google.com";
	process.Start();
}