Run Rhino 6 and python script from Windows command line

Hello,

I’m trying to do something really simple, namely run Rhino from windows command line with some arguments:

.\Rhino.exe /nosplash /runscript="!-_RunPythonScript (C:<path_to_python_script>\script.py)" C:<path to input file>\rhino-testbench.3dm

What I want to achieve with this is to:

  1. Launch Rhino 6 -> works
  2. Open the input 3dm file I provide -> works
  3. Run the python script I provide -> does not work

Rhino 6 does not run the script. it’s doesn’t to anything and the console does not show any information whatsoever. It’s like it’s ignoring the /runscript part entirely. In fact, this official doc here https://developer.rhino3d.com/guides/cpp/running-rhino-from-command-line/ does not work either. I see it’s Rhino 5, but I’m running Rhino 6.

Does this mean, I cannot use Rhino 6 to run python scripts from the command line?

Also, I tried pasting !-_RunPythonScript (C:<path_to_python_script>\script.py) in Rhino’s command line to check if there’s something wrong with it, and it’s not. It runs the script as it should. So this makes me think the problem is elsewhere. Is there a verbose mode I can launch Rhino 6 with to see what’s going on?

I would really appreciate some help here because I’m currently relying on this automation in order to have things working.

Thanks

The command format “RunPythonScript()” is incorrect.

You can refer to the following format:

“D:\Program Files\Rhino 6\System\Rhino.exe” /nosplash /runscript="-_RunPythonScript d:/test.py" d:/test.3dm

1 Like

Thank you for your response, but unfortunately it does not work. The same thing as before is happening. Rhino starts, loads the provided input .3dm but does not run the script. And it does not provide any information in the console. Also, like I said before, pasting:

-_RunPythonScript <path_to_python_script>.py

Inside Rhino’s command line while running runs the script perfectly fine…

Hi @alexandrupopoviciioa,

This in a batch file seems to work:

C:
CD "\Program Files\Rhino 6\System"
Rhino.exe /nosplash /runscript="_-RunPythonScript (C:\Users\Dale\Desktop\test.py)"

– Dale

Hi Dale,

Thank you for your response. After several other attempts, it looks like the issue I’ve described in my previous posts was because I was running the command from windows PowerShell… When running it from the command line(cmd.exe) it runs fine.