Skip to content

Instantly share code, notes, and snippets.

@AkihiroImada
Created September 10, 2018 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkihiroImada/38f62e5e4920e699ce5faa70fb88e6d9 to your computer and use it in GitHub Desktop.
Save AkihiroImada/38f62e5e4920e699ce5faa70fb88e6d9 to your computer and use it in GitHub Desktop.
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