This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Can I run DOS commands during installation?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2009
10:43 AM
Can I run DOS commands during installation?
I am trying to streamline my product installation as much as possible. One of the things I cannot figure out how to do is run DOS commands during the install process.
One of the tasks that I need to automate is adding a new entry to the Windows hosts file. Here is the command I currently run post-installation:
echo 127.0.0.1 SportsServer >> c:\windows\system32\drivers\etc\hosts
Is there is a way to script this command to run during the installation? That would save me a step each time I setup a customer computer.
Thanks very much for any assistance.
One of the tasks that I need to automate is adding a new entry to the Windows hosts file. Here is the command I currently run post-installation:
echo 127.0.0.1 SportsServer >> c:\windows\system32\drivers\etc\hosts
Is there is a way to script this command to run during the installation? That would save me a step each time I setup a customer computer.
Thanks very much for any assistance.
(7) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2009
03:26 PM
basic msi or installscript project type?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2009
03:30 PM
Basic MSI project.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2009
03:48 PM
launch the custom action wizard.
Type: launch an Executable
Location: directory table
source: SystemFolder
target: cmd.exe /c echo 127.0.0.1 SportsServer >> %systemroot%\system32\drivers\etc\hosts
that should do it!
Type: launch an Executable
Location: directory table
source: SystemFolder
target: cmd.exe /c echo 127.0.0.1 SportsServer >> %systemroot%\system32\drivers\etc\hosts
that should do it!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 05, 2009
11:28 AM
That definitely looked like it would work, but I must have missed a step somewhere along the line. I experimented with the Custom Actions a bit more based upon the above information and here is what I have come up with:
If I create a batch file with the script from above, and run it from anywhere on the target computer, it works exactly as expected. So I know that the script is solid.
I monitored the Windows Task Manager during my installation and it doesn't seem like cmd.exe is called because it never shows up in the processes list as I thought it would. I tried changing the script to have the cmd.exe do other menial tasks (copy a file) and none of them completed.
Here are all the settings that I configured for this action:
Working Directory - SystemFolder
Filename & Command Line - cmd.exe /c 127.0.0.1 SportsServer >> %systemroot%\system32\drivers\etc\hosts
Return Processing - Synchronous (Check Exit Code)
In-Script Execution - Immediate Execution
Execution Scheduling - Always Execute
Do I have to add something else to my setup design in order for this to work?
If I create a batch file with the script from above, and run it from anywhere on the target computer, it works exactly as expected. So I know that the script is solid.
I monitored the Windows Task Manager during my installation and it doesn't seem like cmd.exe is called because it never shows up in the processes list as I thought it would. I tried changing the script to have the cmd.exe do other menial tasks (copy a file) and none of them completed.
Here are all the settings that I configured for this action:
Working Directory - SystemFolder
Filename & Command Line - cmd.exe /c 127.0.0.1 SportsServer >> %systemroot%\system32\drivers\etc\hosts
Return Processing - Synchronous (Check Exit Code)
In-Script Execution - Immediate Execution
Execution Scheduling - Always Execute
Do I have to add something else to my setup design in order for this to work?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 05, 2009
04:31 PM
probably need to run "deferred in system context." if a CA needs admin privs to run, it must run deferred in system context.
okay, upon closer inspection, it looks like you forgot to type "echo" immediately following the /c...unless that's just a transcription typo, and you've actually got it right in the project.
okay, upon closer inspection, it looks like you forgot to type "echo" immediately following the /c...unless that's just a transcription typo, and you've actually got it right in the project.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 06, 2009
08:26 AM
That was just an error when I copied it over to the post, sorry about that. It is correct in my project.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 06, 2009
08:56 AM
No luck with the "deferred in system context".
What if I approached this a different way and instead of running a command line operation I called a .bat file which I included in the project?
I noticed there is a straight-forward way of running an executable that is installed. Can something similar be done with a batch file?
What if I approached this a different way and instead of running a command line operation I called a .bat file which I included in the project?
I noticed there is a straight-forward way of running an executable that is installed. Can something similar be done with a batch file?