Solved

How do I run a command from Installshield?

Posted on 2008-10-20
6
10,589 Views
Last Modified: 2013-11-14
I need to run a command after installshield has finished installing our software, is this possible? If not, how do I launch a program, for instance a batch file?


Any help would be great!



Ian
0
Comment
Question by:jjumpm2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 22763139
Hi, if you run the setup task waiting for completion, the next line in the batch file would only execute once it is finished....something like this....

Regards,

Rob.
@echo off
start /wait c:\software\Setup.exe /qn
C:\Software\BatchToRun.bat

Open in new window

0
 

Author Comment

by:jjumpm2
ID: 22765463
Hi,

Thank you for your reply. I will try and make it clearer what I am trying to do..

I have a Installshield project that installs our software. After it has installed the files, I need it to run a command (like you would from the start menu using "Run"). If this is not possible, I could also do it using a batch file, so I would need the installer to run that after the install has finished..


Ian
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 22770754
Hi, you're InstallShield would still be able to be started by using a command line, right?  So you could just relplace this line in the code above

start /wait c:\software\Setup.exe /qn

with a command that would start your InstallShield install, then the line after that would run when the install is finished.

Regards,

Rob.
0
 
LVL 1

Expert Comment

by:ISCopernicus
ID: 22783759
If you have an InstallScript based Setup you can use the built-in LaunchAppAndWait function to launch an external program via InstallScript code.
Make sure that you set the current directory to a path that actualy exists on the target computer before calling the LaunchAppAndWait function, for example:
szCurrent = WINSYSDIR;
LAAW_PARAMETERS.lpCurrentDirectory = &szCurrent;
LaunchAppAndWait ( szProgram, szCmdLine, nOptions );

In case you need to run a program with multiple command line parameters it's a good idea to use cmd.exe as szProgram, and to specify the executable in szCmdLine:
szCurrent = TARGETDIR;
LAAW_PARAMETERS.lpCurrentDirectory = &szCurrent;
szProgram = TARGETDIR ^ "MyProgram.exe";
LongPathToQuote(szProgram, TRUE);
szCmdLine = "\"" + szProgram + " -param1 -param2\""
nResult = LaunchAppAndWait ( "cmd.exe /c", szCmdLine, nOptions );

You can even customize the _LaunchAppEx InstallScript function by using the version available at http://www.installsite.org:
http://www.installsite.org/files/LaunchAppEx.zip
0
 
LVL 3

Expert Comment

by:MSI_installer_expert
ID: 23911018
If you are using Installshield to edit your setup project file, you can simply navigate into the custom actions tab. There you will find all kinds of custom actions to run, like:
new vb script, new exe, new dll
I recommend using new exe since you only need to execute a setup commmand, and depending on the command line, you have more options to select.

If you are using install shield and cannot find this easily, I can upload a screenshot.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question