Calling Opus from a script

I want to run directory opus from a script.
dopus.exe does the trick. This works:

So far so good. This works:

[code]# $language = "VBScript"

$interface = "1.0"

' Run.vbs demonstrates how to utilize the Windows Scripting Host (WSH) by using
' its 'Run' method to execute other programs. Note the use of nested quotes to pass
' a path that contains spaces along with command line arguments.

Sub Main

Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run """C:\Program Files\GPSoftware\Directory Opus\dopus.exe"" D:\data"

End Sub
[/code]
Now I want to open directory opus at a different location.
It seems I have a problem when I reference a folder with spaces in the name.
When I try this:

[code]# $language = "VBScript"

$interface = "1.0"

' Run.vbs demonstrates how to utilize the Windows Scripting Host (WSH) by using
' its 'Run' method to execute other programs. Note the use of nested quotes to pass
' a path that contains spaces along with command line arguments.

Sub Main

Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run """C:\Program Files\GPSoftware\Directory Opus\dopus.exe"" D:\Data\SecureCRT\Scripts\Development\Run External Command"

End Sub
[/code]
I get this:

It seems to read the URL as far as the first space.
Ideas...? Thanks in advance..

Put quotes around the arguments, just like you have them around the command.

Hi Jon
Have I not done this with the quotes in red below?
I left the space (blue) as I was copying a windows explorer example which worked.
You may need to spell this one out sorry :slight_smile:

No, you haven't. Double-quotes need to be paired. Look at which double-quote marks match up and you'll see that only the dopusrt command is enclosed, not its arguments. The very outer pair of quotes are enclosing the entire argument string to the shell.Run method - the inner quotes are only enclosing the dopusrt command.

Try this (and once you've tried it, try and understand it):

shell.Run """C:\Program Files\GPSoftware\Directory Opus\dopus.exe"" ""D:\Data\SecureCRT\Scripts\Development\Run External Command"""

The double double-quotes (""C:\Program Files...\dopus.exe"" etc) are a peculiarity of VBScript - a double double-quote is the way you insert a literal " character into a string.

Bingo. Thanks Jon, appreciate it.