How do you run a batch file? - Advanced Installer Community
stevericketts
Posts: 10
Joined: Sun Feb 12, 2006 2:50 pm

How do you run a batch file?

I'd like to run a batch file at the end of the installation process, preferably if it didn't exist before the installation started.

I put a custom action on commit to run the batch file from vbs (why no batch option?) which looks like:

dim shell: set shell=Wscript.createObject("Wscript.shell"): shell.run "c:\program files\theDir\inst.bat"

I've tried:
o Synchronous execution, ignore return code
o Asynch execution, do not wait for return
o Commit with no impersonation (I assume that means install under the local system account)

The files are copied properly but the batch file isn't executed.

I've removed all the Execution Condition information just to try and get the batch file to run but no luck. Any advice would be great.
stevericketts
Posts: 10
Joined: Sun Feb 12, 2006 2:50 pm

Fixed`

I put a .vbs msgbox statement with the installation script and found it wasn't getting executed at commit. So, I moved the inline scripts to deferred with no impersonation and they executed... at least tried.

I found another post that said don't use Wscript.createObject, just use createObject. So, I did and at least the script worked.

I purchased AI about a month ago and still don't have a good picture of when things get executed... or why. I've seen many posts asking for examples. Add my vote to that! What would also be very helpful would be a flowchart that shows the entire installation cycle, decision points, execution points, etc.

Regards,

Steve
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Steve,

You are right about the examples. But all these concepts regarding Standard and Custom Actions, Execution Options etc are actually related to Windows Installer and they are documented in the Platform SDK. Please see the following page for details about Custom Actions:
http://msdn.microsoft.com/library/defau ... ctions.asp

It is not necessary to create a VBScript in order to execute a BAT file. Please see the following thread for details about executing a BAT file included in your package at the end of the setup process:
http://www.advancedinstaller.com/forums ... php?p=2831

Please see my post in the following thread which presents a short overview of the installation process:
http://www.advancedinstaller.com/forums ... .php?t=980

Hope this helps.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”