VBS script with spaces in executable path

  • Thread starter Thread starter Tyler Durden
  • Start date Start date
T

Tyler Durden

I'm trying to write a vbs to run vncviewer on a relative path. The following
code works, except when the path has spaces:

Dim LaunchDir, FSO, WSHShell
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")
LaunchDir = FSO.GetFolder(".")

wSHShell.Run LaunchDir & "\vncviewer.exe -notoolbar -autoscaling
myhost.dyndns.org"

Where's the error?
Any help would be appreciated.
 
From: "Tyler Durden" <[email protected]>

| I'm trying to write a vbs to run vncviewer on a relative path. The following
| code works, except when the path has spaces:

| Dim LaunchDir, FSO, WSHShell
| Set FSO = CreateObject("Scripting.FileSystemObject")
| Set WSHShell = WScript.CreateObject("WScript.Shell")
| LaunchDir = FSO.GetFolder(".")

| wSHShell.Run LaunchDir & "\vncviewer.exe -notoolbar -autoscaling
| myhost.dyndns.org"

| Where's the error?
| Any help would be appreciated.


I suggest asking here... microsoft.public.windows.server.scripting
 
I'm trying to write a vbs to run vncviewer on a relative path. The
following code works, except when the path has spaces:

Dim LaunchDir, FSO, WSHShell
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")
LaunchDir = FSO.GetFolder(".")

wSHShell.Run LaunchDir & "\vncviewer.exe -notoolbar -autoscaling
myhost.dyndns.org"

Where's the error?
Any help would be appreciated.

Put quotes around the paths. e.g. "c:\path\...\...\" Then it sees the
entire path, not just part of it.
 
Back
Top