Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Windows XP

Windows XP Discuss the Microsoft Windows XP Operating System



Reply
 
LinkBack Thread Tools
  #1  
Old 10-17-2008, 02:23 AM
Tyler Durden
Newsgroup Contributor
 
Posts: n/a
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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 10-17-2008, 02:23 AM
  #2  
Old 10-17-2008, 02:23 AM
David H. Lipman
Newsgroup Contributor
 
Posts: n/a
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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3  
Old 10-17-2008, 02:23 AM
Michael A. Loginov
Newsgroup Contributor
 
Posts: n/a
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.
>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4  
Old 10-17-2008, 02:26 AM
Twayne
Newsgroup Contributor
 
Posts: n/a
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.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
file path spaces Boliver Microsoft Office 5 02-07-2008 10:41 AM
An executable file to run a VB script? Zakynthos Windows XP 3 08-10-2007 05:30 AM
executable for cmd not in path? Dick Watson Windows XP 8 03-05-2007 03:30 PM
files with spaces in the full path analyst41@hotmail.com Windows XP 3 01-13-2007 12:00 PM
How to link to local file in OneNote when path contains spaces? Paula Microsoft OneNote 1 01-06-2007 11:17 PM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 04:14 PM.


2003 - 2010 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0