call of the script, e.g.:
script.vbs "C:\Programme\Microsoft Reference\Bookshelf 96\bshelf96.exe"
Thereafter I get the name and path of the executable by:
Set objArgs = Wscript.Arguments
programmeName = objArgs(0)
Finally I try to run the executable by:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run(programmeName)
WSH won't find the programme named programmeName because of the spaces
in the path. Even a call with more double-quotes as
script.vbs """C:\Programme\Microsoft Reference\Bookshelf
96\bshelf96.exe"""
won't work.
The line
WshShell.Run(""" & programmeName & """)
didn't help either.
So, how can I call an executable by variable with spaces in the name?
Florian Dietz
Dim obj As Object
Dim FileName
Set obj = CreateObject("WScript.Shell")
FileName = "C:\Program Files\Accessories\Msaint.exe"
FileName = Chr(34) & FileName & Chr(34)
obj.Run FileName
hope this helps?
In article <35C9BC17...@irt.rwth-aachen.de>,
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
I solved the problem by putting 4 (four!) double-quotes in the line:
WshShell.Run("""" & programmeName & """")
The first one is to mark the beginning of the string, the second and
third double-quotes stand for one double-quote contained in a string,
and finally, the fourth to close the string.
Florian