- Home /
Question by
Eco-Editor · Jul 03, 2017 at 02:33 PM ·
c#script.fileautomationbatch
VBScript through C# in Unity
Hello!
Did anyone here tried executing functions through VBScript in Unity?
I found this peace of code, and would like to hear about your overall experience before diving in.
code in c#:
using System.Diagnostics;
Process scriptProc = new Process();
processFileName = "Recorder.exe";
//processFileName = @"C:\Windows\SysWOW64\cscript.exe";
string processArguments = "A.vbs";
scriptProc.StartInfo.FileName = processFileName;
scriptProc.StartInfo.Arguments = processArguments;
scriptProc.StartInfo.CreateNoWindow = false;
scriptProc.StartInfo.Verb = "runas";
scriptProc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
scriptProc.StartInfo.UseShellExecute = false;
scriptProc.StartInfo.LoadUserProfile = true;
try
{
scriptProc.Start();
scriptProc.WaitForExit();
int exitcode = scriptProc.ExitCode;
scriptProc.Close();
print("Exit code: " + exitcode);
}
catch (Exception e)
{
print("Error is " + e.Message);
}
}
Thanks
Comment