In my opinion, trying to automate Rhino in this manner is difficult. For one, there are a limited number of characters you can pass to an application on the command line. And, the command line syntax can be very tricky, especially for file names and even trickier. File names with spaces in them will need nested double-quote characters.
An alternative approach to consider is to automate Rhino using ActiveX automation. Do to this, you would create a script (using either VBScript or JScript) which would launch Rhino. Once Rhino was running, you could have the script tell Rhino to run some commands.
Here is a fairly simple script that runs Rrhino, draws a few curves, saves the file to your desktop, and then closes.
Option Explicit
Sub TestRhinoAutomation
' Declare local variables
Dim objRhino, objShell, strDesktop, strPath
' Create a Rhino 5 64-bit application object
On Error Resume Next
Set objRhino = CreateObject("Rhino5x64.Application")
If Err.Number <> 0 Then
On Error Resume Next
' Create a Rhino 5 32-bit application object
Set objRhino = CreateObject("Rhino5.Application")
If Err.Number <> 0 Then
Call WScript.Echo("Failed to create Rhino object.")
Exit Sub
End If
End If
Call WScript.Echo("Rhino object created.")
' Run some commands
Call objRhino.RunScript("_Circle 0 10", 0)
Call objRhino.RunScript("_Line -5,-5,0 5,5,0", 0)
Call objRhino.RunScript("_Line 5,-5,0 -5,5,0", 0)
Call WScript.Echo("Geometry created.")
' Create a shell object
Set objShell = WScript.CreateObject("WScript.Shell")
Call WScript.Echo("Shell object created.")
' Get the desktop folder
strDesktop = objShell.SpecialFolders("Desktop")
strPath = Chr(34) & strDesktop & "\TestRhinoAutomation.3dm" & Chr(34)
' Save the file
Call objRhino.RunScript("_-Save " & strPath, 0)
Call WScript.Echo("File saved.")
' Exit Rhino
Call objRhino.RunScript("_Exit", 0)
Call WScript.Echo("Done!")
End Sub
' Run the subroutine defined above
Call TestRhinoAutomation
To run the script, you’d use the CSCRIPT command-line command.
C:\> cscript TestRhinoAutomation.vbs
Also, from automation, you can get a hold of the RhinoScript object and call methods on it (if you need to get fancier). Here is an example of that.
Does this help?