Rhino script at startup does not work with path including spaces

In https://docs.mcneel.com/rhino/8mac/help/en-us/commands/grasshopper.htm?Highlight=grasshopper it is said that the filename of the grasshopper file may include spaces, and in this case it is necessary to enclose it within double quotes.
I works well when it is used in the command line inside Rhino, but what I need is to run the command at Rhino startup. So, I use command line arguments like it is explained in: https://developer.rhino3d.com/guides/cpp/running-rhino-from-command-line/

This is my command-line (Batch *.bat file):
Rhino.exe /nosplash /runscript="-Grasshopper D O “C:\Test Open\Test.gh” W H -MaxViewport“

It does not work on my Rhino 8 (Windows11). The space between “Test” and “Open” breaks the script.

So, the problem is: when typed in as command inside Rhino, it works perfectly and the path may include spaces (enclosing it with double quotes), but if passed as a script to run at statup, through the command line from the operating system, the double quotes break the script and it does not work.

Does anyone know how to solve this issue?

Thanks a lot!

Try putting the path in parentheses. Works for a Rhino startup python script path with spaces.

HTH
Jeremy

1 Like

Thank you, @Jeremy!

At first, I thought your suggestion (coming originally from @Dale) was going to work, but it does not.

image

It is the way a python script (path with spaces) may be called from the command line arguments.

But I’m not calling any python script. I’m running a Rhino scrip that consists only of one command for opening Grasshopper loading a specified file.

Perhaps it is possible to put the Rhino command in a Python script and then running it from the Rhino command line at startup.

But I was searching for a way of calling the Rhino command “-Grasshopper D O FileName.gh”, using a FileName white spaces.

Any other suggestion?

Anyway, thank you!!!

It should be:

Rhino.exe /nosplash /runscript="-Grasshopper D O ""C:\Test Open\Test.gh"" W H -MaxViewport"

Note the double double-quotes.

I have a file space is real.gh

I have a shortcut link with /runscript, the path to the GH file is in the double double-quotes

Using the shortcut gives

Note in the last screenshot that the path to the file is also in double-quotes. That is because in the shortcut I enclosed it in double double-quotes.

1 Like

Wow, double-double quotes: quadruple quotes :wink:

I should have tried it!

Anyway, @nathanletwory , you solved it. THANKS!!!

Finally, do you know how to finish the command? In the Rhino command line, it remains the -Grasshopper command active.

It is easily finished, pressing “Enter”. But I would like to achieve it through the script used at the startup.

Add _Enter at the end of the script you run, before the final double-quote

1 Like