Skip to content

Instantly share code, notes, and snippets.

@AkihiroImada AkihiroImada/CMD.cs
Created Sep 10, 2018

Embed
What would you like to do?
Unityからコマンドプロンプトを起動するスクリプト.
using UnityEditor;
public static class CMD
{
[MenuItem("CMD/Debug/EchoTEST")]
public static void EchoTEST()
{
Call("/k echo TEST", false);
}
private static void Call(string cmd, bool isHide = true)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
if(isHide) startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = cmd;
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.