Launching Rhino 5 with a batch file and running c# scripts


I am interested in running Rhino 5 remotely using a batch file. Here’s what I need to do with one batch file:

  • Launch Rhino 5
  • Run a c# script (the command “RunScript”)
  • Exit Rhino

The c# script makes a new text file. I can work out how to run Rhino via a batch file, but not run the script.

I trying to use the “/runscript” command, but I get an error “The system cannot find the file specified”

This code works good:

           ProcessStartInfo start = new ProcessStartInfo();
            start.FileName = "C:\\Program Files\\Rhinoceros 5 (64-bit)\\System\\Rhino.exe";
            start.WindowStyle = ProcessWindowStyle.Hidden;
            start.CreateNoWindow = true;
            start.UseShellExecute = false;
            int exitCode;

                using (Process proc = Process.Start(start))
                    exitCode = proc.ExitCode;

but if I add then “/runscript” command, get the error “The system cannot find the file specified”

           start.FileName = "C:\\Program Files\\Rhinoceros 5 (64-bit)\\System\\Rhino.exe /runscript=\"TestWriteFile\"";

Thanks very much, if you need any specifics let me know.

I resolved with this code

1 Like


This code works but when I run several times continuously it returns an error in the rhino = System.Activator.CreateInstance(type)

That’s the error:
Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))

It’s running in Windows Server