Run command

In a button script, I use the _run command.
_run “D:\SomeExe.exe D:\Temp\FiletoProcess.txt”
No problem.

Problem starts with spaces in the file name.
Then we need to enclose the file name in quotes.

Could look like:
_run “D:\SomeExe.exe” “D:\Temp\File to Process with spaces.txt”
Can’t work because of the space between executable’s name and the parameter.

_run “D:\SomeExe.exe D:\Temp\File to Process with spaces.txt”
Works in Rhino, but not for the executable.
The parameter must be enclosed in quotes, as Windows does.

The quotes can only be left out for filenames with no spaces.


Ideas?

-C-H-A-R-L-E-S-

Double double quotes should work… or?

_Run ""D:\SomeExe.exe D:\Temp\File to Process with spaces.txt""

–Mitch

No, doesn’t work.

This also not:
_Run ““D:\SomeExe.exe” “D:\Temp\File to Process with spaces.txt””

I think this will never work with the _run.
Now I will try with the shell object.

I will report.

Dunno, the following seems to work for me, only single double quotes:

_Run "C:\Windows\Notepad.exe D:\Desktop\Hello World.txt"

–Mitch

Seems my executable is too dense then…

Ok, have it working without the _run command:

Dim ws
Set ws = createobject("Wscript.shell")
...	
C2 = chr(34) & FullExePath & chr(34) & chr(32) & chr(34)  & DTFolder & "\" & TempFile & chr(34)
ws.exec c2
set ws=nothing

Works exactly as expected.

Anyway, thank you Mitch.

Hello, how can i do in python?

I have this:

rs.SelectObjects(objs)
pt=str(corner1.X) + ',' + str(corner1.Y) + ',' + str(corner1.Z)
savename="D:\docs\New Projects\project 5885.dxf"
cmd = "_-ExportWithOrigin " + pt + " " + savename
rs.Command(cmd)

Thank’s