Help Spaces in folder names 
Author Message
 Help Spaces in folder names

WSH has no problem showing and getting path information for folders with
spaces in their names.  But the second I try to use WSH and run to
start  a program that is in a folder that has a space in the name it
fails.   Is this a problem with WSH or is there a work-around?

David Hamel



Sun, 06 May 2001 03:00:00 GMT  
 Help Spaces in folder names
Did you enclose the name in double quotes *within* the string? Use Chr(34)
to do this.

--
Tim Hill -- Windows NT MVP

(Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any and all
nonsolicited commercial E-mail sent to this address is subject to a download
and archival fee in the amount of $1000 US.  E-mailing denotes acceptance of
these terms.)

Quote:

>WSH has no problem showing and getting path information for folders with
>spaces in their names.  But the second I try to use WSH and run to
>start  a program that is in a folder that has a space in the name it
>fails.   Is this a problem with WSH or is there a work-around?

>David Hamel



Sun, 06 May 2001 03:00:00 GMT  
 Help Spaces in folder names

Quote:

>WSH has no problem showing and getting path information for folders
with
>spaces in their names.  But the second I try to use WSH and run to
>start  a program that is in a folder that has a space in the name it
>fails.   Is this a problem with WSH or is there a work-around?

The problem is that when WSH sees the space, it thinks it is the end
of the command line and that all words after the space are arguments.
To make WSH see the entire string as one command, enclose the string
itslef it quotes.  This gets a little tricky, because you already have
to put it in quotes to let WSH know it is a string.  But the string
itself needs to have quotes too. In VBScript, you can put quotes
inside a string by using a double quote ("") wherever one quote is
needed. Here's an example:

objShell.Run """C:\Program Files\test.bat"""

If you're using JScript, you can put the quotes in the string by
enclosing the string with single quotes, like in this example:

objShell.Run ('"C:\Program Files\test.bat"');

Another way to fix the problem would be to use the short file-name
(which wouldn't have spaces), but you'd have to go to the trouble of
converting the long file name to its short file name.
I hope this helps!

Good Luck,
Russell Davis



Sun, 06 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Browse.WshKit Won't Work On Folders Names with Spaces

2. HELP -- Can't Run programs with spaces in directory name

3. First file name in folder script help

4. Language independent folder names (special folder)

5. Changing Printer names (displayed names in printer folder)

6. used space in a folder

7. Calculate Space on users folders

8. Calculate space on users folders

9. Spaces in Folders

10. JScript & Folders with Spaces

11. JScript and Folders with Spaces

12. space in name of htm file on local computer

 

 
Powered by phpBB® Forum Software