Hi,
I am trying to run a batch file automatically after the installation of my project setup. i had create a setup project and add my batch file at application, commands written in batch file is as follows
@ECHO ON
@SET PATH="%CD%\bin";%PATH%
@SET PGDATA=%CD%\data
@SET PGDATABASE=postgres
@SET PGUSER=postgres
@SET PGPORT=5432
@sET PGLOCALEDIR=%CD%\share\locale
%CD%\bin\initdb -D %CD%/data
%CD%\bin\pg_ctl -D %CD%/data -l logfile start

added a custom action install and commit and write a code in installer class like this
Public Overrides Sub Install(ByVal stateSaver As IDictionary)
MyBase.Install(stateSaver)
Dim dir As String = MyBase.Context.Parameters("dir").ToString()
'Change this string to the bat file name
Dim batFileName As String = "postgresql.bat"
'Execute the bat file.
System.Diagnostics.Process.Start(dir & batFileName)
End Sub

Public Overrides Sub Commit(ByVal savedState As IDictionary)
MyBase.Commit(savedState)
Dim dir As String = MyBase.Context.Parameters("dir").ToString()
'Change this string to the bat file name
Dim batFileName As String = "postgresql.bat"
System.Diagnostics.Process.Start(dir & batFileName)
End Sub

but problem is that during the installation process it only launches the black screen ( command screen ) for a while but doesn't execute the command written in batch file.

When this batch file is executed by double click, it works pefectly but from a setup custom action it is not working.

is i m doing the correct process or is ther some other way to run this batch file from custom action
Please help...its urgent
0 Comments   [ + ] Show Comments

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.

Answers

0
@SET PATH="%CD%\bin";%PATH%


What does the Environmental variable %CD% point to?
Answered 05/06/2011 by: an33th
Orange Belt

Please log in to comment
0
hi aneeth,
The %CD% returns the folder path of current directory
Answered 05/06/2011 by: shilpa24
Yellow Belt

Please log in to comment
0
Er...you have created one hell of a complex "solution" for what is a very simple operation.

Just call CMD.EXE in your CA and pass it the name of the batch file as the argument. Remember you should ALWAYS specify full paths in CAs (obviously you can use properties for that).

Also, this forum is designed for problems connected with errors returned by Windows Installer (see the link 'MSI Errors' fr examples). You ought to have posted in the 'Scripting' forum. A moderator may move the thread.
Answered 05/06/2011 by: VBScab
Red Belt

Please log in to comment
0
Jus create a custom action and place it after InstallFinalize in Immediate execute custom action with the NOT INSTALLED condition will solve your problem.
Answered 06/27/2011 by: kanthsri87
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity