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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Blanks in Pathname

Status
Not open for further replies.

kottan

Programmer
Jan 28, 2002
2
DE
Hi,
i want to start an application with the run method e.g.:

set objShell = wscript.createObject("wscript.shell")
objShell.run("c:\in test\notepad.exe")

But Vbscript doesn't like the blank in "in test"
What do I have to do to make the script working properly?

regards

Björn
 
try inserting %20 in your path like this.

set objShell = wscript.createObject("wscript.shell")
objShell.run("c:\in[red]%20[/red]test\notepad.exe")

that or if you can change the folder name, change it to something like:

set objShell = wscript.createObject("wscript.shell")
objShell.run("c:\in[red]_[/red]test\notepad.exe")

hth
mb
 
The first problem I see is having the parentheses around your path. You don't need that in VBScript if you are just calling a sub/function and not expecting a return value.

You can add the double quotes to the beginning and end to fix the space problem. ie.

objShell.run """c:\in test\notepad.exe"""

hth
Dave
 
If you are trying to use this as a stand alone program and not HTML, try below. For some reason the """ does not work.

quote = Chr(34)
pgm = "AMC Installation Help.hhp"
Set objWSHShell = CreateObject("WScript.Shell")
objWSHShell.Run quote & pgm & quote

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top