Guest Tyler Durden Posted August 27, 2008 Posted August 27, 2008 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.
Guest David H. Lipman Posted August 27, 2008 Posted August 27, 2008 Re: VBS script with spaces in executable path From: "Tyler Durden" <abuse@antispam.org> | 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 -- Dave http://www.claymania.com/removal-trojan-adware.html Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp
Guest Michael A. Loginov Posted August 27, 2008 Posted August 27, 2008 Re: VBS script with spaces in executable path Path with spaces should be in quotes. So, modify Your last code row: wSHShell.Run """" & LaunchDir & "\vncviewer.exe" & """" & " -notoolbar -autoscaling myhost.dyndns.org" Something like this, if I wasn't mistaken... Tyler Durden wrote: > 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. > >
Guest Twayne Posted August 27, 2008 Posted August 27, 2008 Re: VBS script with spaces in executable path > 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.
Recommended Posts