Windows Script Host

Posted: 07-16-2003, 06:45 PM
It appears that Wscript does not process folder names with
spaces such as c:\program files\microsoft office....
I have different versions of office and need to address
one or the other.

Is there a simple way to work around that constraint
inherited from the eighties without modifying the standard
setup in my organization.


Reply With Quote

Responses to "Windows Script Host"

Rick Bean
Guest
Posts: n/a
 
Re: Windows Script Host
Posted: 07-16-2003, 09:22 PM
Antoni,
As with all Windows code, put quotes (") around the file name. e.g.
"c:\program files\microsoft office...."

Rick

"antoni" <antoni.gervais@fid.desjardins> wrote in message news:007b01c34bc2$0211de90$a501280a@phx.gbl...
> It appears that Wscript does not process folder names with
> spaces such as c:\program files\microsoft office....
> I have different versions of office and need to address
> one or the other.
>
> Is there a simple way to work around that constraint
> inherited from the eighties without modifying the standard
> setup in my organization.
>
>
Reply With Quote
antoni
Guest
Posts: n/a
 
Re: Windows Script Host
Posted: 07-17-2003, 02:07 PM
Thanks for your comments.

My path is in a variable. The same happens when written
directly. For the same reason I cannot copy the shortcut
called "microsoft access.lnk". If I change the name
to "microsoftaccess.lnk" the copy works fine.

I just realised that my script works under NT but not
under XP.
There must be something missing in the XP installation. I
do not know what that could be.
I am open for suggestions.

>-----Original Message-----
>Are you sure that the function that is getting the folder
string is getting
>it with quotes around it? If you were doing the same
thing using cmd.exe
>(cd, copy, etc) You have to put quotes around any path or
file name that
>contains a space.
>
>"antoni" <antoni.gervais@fid.desjardins> wrote in message
>news:007b01c34bc2$0211de90$a501280a@phx.gbl...
>> It appears that Wscript does not process folder names
with
>> spaces such as c:\program files\microsoft office....
>> I have different versions of office and need to address
>> one or the other.
>>
>> Is there a simple way to work around that constraint
>> inherited from the eighties without modifying the
standard
>> setup in my organization.
>>
>>
>
>
>
>
>-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-
----
>http://www.newsfeeds.com - The #1 Newsgroup Service in
the World!
>-----== Over 80,000 Newsgroups - 16 Different Servers! =-
----
>.
>
Reply With Quote
Bill James
Guest
Posts: n/a
 
Re: Windows Script Host
Posted: 07-17-2003, 08:55 PM
Paths with spaces need to be wrapped in quotes, just like any other command line. Actually, with scripting you usually need to use 3 sets of quotes since the quote mark is an escape character in VBScript.

--

Bill James
Microsoft MVP·DTS

Win9x VBScript Utilities » www.billsway.com/vbspage/
Windows Tweaks & Tips » www.billsway.com/notes_public/

"antoni" <antoni.gervais@fid.desjardins.com> wrote in message news:039b01c34c9b$f4d864d0$a301280a@phx.gbl...
> When I refer in a command to a file or folder containing a
> space (i.e. C:\Program files\microsoft office\....) I get
> a message of file not found under XP but it works properly
> under NT.
>
> I imagine the XP installation is incomplete. But what is
> missing. I am open to suggestions.
> thanks in advance.
Reply With Quote
antoni
Guest
Posts: n/a
 
Re: Windows Script Host
Posted: 07-18-2003, 07:09 PM
Today calls using path with spaces do not work on NT or XP
Here is sample simplified code to illustrate what happens.
I use the French versions of Windows.

<job id="Test">
<script language="Vbscript">

dim WshShell, AcPath
dim Return

'The following gives a file not found
'AcPath = "C:\Program files\Microsoft office\office\"

'The following displays the folder content
'AcPath = """C:\Program files\Microsoft office\office\"""

'The following opens the default version of Access
'AcPath = ""

msgbox AcPath

set WshShell = Wscript.CreateObject("WScript.Shell")

Return = WshShell.run (AcPath & "msaccess.exe",1,true)


MSGBOX "The End"

</script>
</job>

Thanks again for your assistance
************************************************** *
>-----Original Message-----
>Paths with spaces need to be wrapped in quotes, just like
any other command line. Actually, with scripting you
usually need to use 3 sets of quotes since the quote mark
is an escape character in VBScript.
>
>--
>
>Bill James
>Microsoft MVP·DTS
>
>Win9x VBScript Utilities » www.billsway.com/vbspage/
>Windows Tweaks & Tips » www.billsway.com/notes_public/
>
>"antoni" <antoni.gervais@fid.desjardins.com> wrote in
message news:039b01c34c9b$f4d864d0$a301280a@phx.gbl...
>> When I refer in a command to a file or folder
containing a
>> space (i.e. C:\Program files\microsoft office\....) I
get
>> a message of file not found under XP but it works
properly
>> under NT.
>>
>> I imagine the XP installation is incomplete. But what
is
>> missing. I am open to suggestions.
>> thanks in advance.
>.
>
Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may 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
Script Error problem with windows xp sp2 Joey451 Windows XP WMI 0 10-26-2007 10:52 PM
Windows Script Host Howard Smith Windows XP Embedded 2 08-04-2003 12:17 PM
Windows Script Host antoni Windows XP Setup 2 07-22-2003 02:01 PM
script errors in windows xp tori Windows XP Printers / Scanners / Fax 0 07-21-2003 08:11 PM
Windows Script Host 5.6 antoni Windows XP 4 07-12-2003 02:32 AM


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90