I have created a repsonse file to install an app, and want to create an MSI wrapper to copy the files to a location on the c:\, then a Custom Action to run the following script (which will be copied to the c:\program files\Scan)

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

WshShell.Run ("C:\Temp\Scan\setup.exe -s -f1" & chr(34) & "C:\Temp\Scan\Canonsetup.iss" & chr(34))

This works as long as the files are in a folder with no spaces (e.g. c:\temp\canon). However, to follow standards I would like to have the files copied to c:\program files\Scan.

The problem I have is that the script fails, due to spaces in Program files I believe.

Therefore, I used:


The trouble I have is that I cannot include 'Programfilesdir' in the following command:

WshShell.Run (ProgramFilesDir\setup.exe -s -f1" & chr(34) & ProgramFilesDir\ScanSetup.iss" & chr(34))

Can anyone recommend what the correct command is to use ProgramFilesDir?

0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Personally, I'd want to know exactly what a vendor installation was going to do to my build, so I'd be capturing the installation to an MSI.
Answered 02/21/2012 by: VBScab
Red Belt

Please log in to comment
Try %ProgramFiles% instead.
Answered 02/21/2012 by: pmarshbu
Orange Belt

Please log in to comment
Thanks for your advice. I did capture as an MSI to see what it did. It's a canon scanner and installs files to a few locations.

Installing the resulting MSI installed the driver (and reported as successful), but sadly the scanning app doesn't pick up the scanner when launched. However, when I run the exe manually the scanning app does see the scanner, which is why I/m using the above method.

I'm sure I tried %ProgramFiles% - will try again.

Thanks again...
Answered 02/21/2012 by: Meic
Second Degree Blue Belt

Please log in to comment
You already have %ProgramFiles%, it's in the ProgramFilesDir variable. I don't think you need quotes to use the Run method. The reason you don't have any content in the variable is because you declare the object as 'WshShell' then try to use it as just 'shell'. I'll bet you have 'On Error Resume Next' in your script, right? Try thisProgramfilesdir=WshShell.expandEnvironmentStrings("%Programfiles%")You'll find using a script debugger most helpful.
Answered 02/21/2012 by: VBScab
Red Belt

Please log in to comment
Thnaks very much for you advice...

Here is what I have done...

Created a Custom Action:

Launch an executable - Shared in the directoey table.

Source - Installdir


"[INSTALLDIR]setup.exe" /s /v/qn "[INSTALLDIR]canonsetup.iss"

Condition - Not Installed.

This installs the driver successfully when running msiexec /i...

I then created a Custom Action for uninstall:

RunVBScript code - stored directly in the custom action.
Dim strFileName
strFileName = Chr(34) & "C:\Program Files\CanonScan\UninstallDriver.vbs" & Chr(34)

Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run "wscript " & strFileName, , True

Here is uninstallDriver.vbs (I got the uninstall cmd in the registry):
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run ("C:\Windows\IsUninst.exe -a -fC:\Windows\PIXTRAN\DR9080C.isu")
This works when I run msiexec /x ..... i.e. it uninstalls the driver.

The trouble is - when I AD deploy the MSI, it installs, but when I uninstall it - it doesn't (Computer Assinged policy). It just hangs there (so can't log on). I looked in event viewer and it looked like it may have been waiting for a response (even though running the msiexec /x in cmd line works (uninstalls it silently)). I don't remember the exact log but it said wscript something...
Very frustrated!

Anyhow, will have another look at it in the morning - thanks again!
Answered 02/22/2012 by: Meic
Second Degree Blue Belt

Please log in to comment
Why the roundabout way of calling the IsUninst.exe? Just create a custom action to call it directly and condition it to only run on uninstall..

Just my 2c ofc.

Answered 02/22/2012 by: pjgeutjens
Red Belt

Please log in to comment