Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spaces in wso.run

Status
Not open for further replies.

Catou

IS-IT--Management
Mar 16, 2008
3
CA
Why do I get "The system cannot find the...file" for the following line:

wso.run "c:\Users\Katherine Bourget\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf"

Yet if I plug-in the same in Run in works. Is it the space in the username (%UserProfile%)?

Catou
 
wso.run """c:\Users\Katherine Bourget\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf"""

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Whitespace is causing the trouble, put double quotes on the path string.

wso.run "c:\Users\Katherine ^ Bourget\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf
 
No avail, I still get Cannot find specified file.." with double quotes or double double quotes. Here's the situation:

userProfile = wso.ExpandEnvironmentStrings("%userprofile%")

wso.run userProfile & "\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf"

Is there a way around this quirk...

Cath


 
What does it show if you echo the string to screen?

e.g.
Code:
wscript.echo "That pesky string is" & vbCrLf & "    '" & userProfile & "\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf'"

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
to:eek:p
You've not tried to understand what others have advised.

>wso.run userProfile & "\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf"
[tt]wso.run [red]"""" & [/red]userProfile & "\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf" [red]& """"[/red][/tt]

or equivalently:

[tt]wso.run [red]chr(34) &[/red] userProfile & "\AppData\Roaming\Microsoft\RT_Files\RTP_Office.pdf" [red]& chr(34)[/red][/tt]
 
Absolutely right..thank you...

Catou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top