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