We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Yugo45
Posts: 6
Joined: Mon Oct 03, 2005 7:54 pm

Running a batch file from installer

How can I run a batch file from the installer?

I tried writing a VBScript that would call it, and the script runs fine when I run it directly. However, once I include it in installer, it fails every time.

Here is the code for the script:

Code: Select all

Function Set_Rights()
Set WshShell=CreateObject("Wscript.Shell")
WshShell.Run(Set_Rights.bat)
End Function
I added this VBScript to the Commit custom action. In the properties I set function name to be Set_Rights. I also selected synchronous execution, check return code, as well as commit execution option and always execute scheduling option. Execution condition is "NOT installed".

What could be the problem?
Yugo45
Posts: 6
Joined: Mon Oct 03, 2005 7:54 pm

Nevermind, I figured it out. I used the viewer.exe to execute the batch file.
peddro
Posts: 10
Joined: Tue Jan 09, 2007 9:22 am

yes you can use viewer.exe to run bath files.
What can you do about spaces in file path ?


regional.bat

Code: Select all

 rundll32.exe shell32,Control_RunDLL intl.cpl,,/f:"C:\Program Files\Ronexprim\ECO MASTER\regopts.txt"
works

runing this on install with viewer

c:\program files\.... gives error about missing program directory


because of the space in dir name

please advice


my error - probably the error is because the installer cannot find the .bat file...




SOLVED
some "" needed to be added in comand line such as
"[#regional.bat]"

Return to “Common Problems”