I am a novice in vbscript. Nonetheless I have an application on all
computers I need to be installed with a script on all computers. The
following works:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run = "D:\TL06\setup.exe -s -f1D:\TL06\setupNEW.iss", 1 True
(-s is to silent install and the -f1 indicates the file location for
the response file needed in the silent install.)

The problem is the folder has a space, so with the change in folder
name the following does NOT work:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run = "D:\TL 06\setup.exe -s -f1D:\TL 06\setupNEW.iss", 1 True
I tried adding extra quotes before and after but it does not work. I
tried declaring variables for the files but that does not work either.

I am missing something? or is it not possible to add arguments to a
file who's path has a space in it? The error that comes up is that The
system cannot find the specified file.
Please help anyone.
R D J

Re: Setup.exe Silent intall w/.ISS not working by Joe_E

Joe_E
Fri Feb 17 16:56:14 CST 2006

Issue is with the spaces in both the path to SETUP.exe and
SETUPNEW.iss.
To deal with this you need to enclose both paths on quotes.
Thry the sample code below. First you specify the install command,
arguments and answerfile and afterwards we add the quotes before
calling WshShell to run:

'<---- VBSCRIPT CODE STARTS HERE -->

Const CMD_WAIT = True
Const CMD_WINDOW = 1

Dim strCmd
Dim strCmdOptions
Dim strAnswerFile
Dim WshShell

strCmd = "D:\TL 06\setup.exe"
'Note there's a space before and after -s
strCmdOptions = " -s -f1"
strAnswerFile = "D:\TL 06\setupNEW.iss"

'Now enclose the install command and the answer file in quotes
strCmd = """" & strCmd & """"
strAnswerFile = """" & strAnswerFile & """"

WScript.Echo "Install Command -> " & strCmd _
& strCmdOptions & strAnswerFile

Set WshShell = WScript.CreateObject("WScript.Shell")

'Replace /k with /c if you want CMD window to close after setup.exe
exists
WshShell.Run "%comspec% /k " & strCmd & strCmdOptions _
& strAnswerFile,CMD_WINDOW,CMD_WAIT

Set WshShell = Nothing
WScript.Quit(0)


'<-- VBSCRIPT CODE ENDS HERE -->


richdj@email.com wrote:
> I am a novice in vbscript. Nonetheless I have an application on all
> computers I need to be installed with a script on all computers. The
> following works:
> Set WshShell = WScript.CreateObject("WScript.Shell")
> WshShell.Run = "D:\TL06\setup.exe -s -f1D:\TL06\setupNEW.iss", 1 True
> (-s is to silent install and the -f1 indicates the file location for
> the response file needed in the silent install.)
>
> The problem is the folder has a space, so with the change in folder
> name the following does NOT work:
> Set WshShell = WScript.CreateObject("WScript.Shell")
> WshShell.Run = "D:\TL 06\setup.exe -s -f1D:\TL 06\setupNEW.iss", 1 True
> I tried adding extra quotes before and after but it does not work. I
> tried declaring variables for the files but that does not work either.
>
> I am missing something? or is it not possible to add arguments to a
> file who's path has a space in it? The error that comes up is that The
> system cannot find the specified file.
> Please help anyone.
> R D J


Re: Setup.exe Silent intall w/.ISS not working by richdj

richdj
Mon Feb 20 10:11:05 CST 2006

Thanks a Million Joe_E, you hit the nail on the head, dead center and
have helped me not to take an aspirin today. The only error I first got
was due to the "%comspec% /k ". It opened the command prompt and could
not find D:\TL but removing that parameter made the whole thing work.
Following the logic in your script I even tried :
WshShell.Run """D:\TL06\setup.exe""" & " -s -f1" &
"""D:\TL06\setupNEW.iss""", 1 True
This also worked. Although I prefer you well thought, structured and
definatly "expandable" logical and programmers way of your script, I
will definately use it.Thank you again.
Rich D J