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
- :
- Re: How to see all command line switches used when setup.exe started?
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
‎Mar 31, 2010
08:13 AM
How to see all command line switches used when setup.exe started?
I have an InstallScript MSI project. I know how to use /z to pass info to the CMDLINE InstallScript variable. What I'm looking for, though, is to access the entire set of arguments used when setup.exe was called. My problem starts with uninstalling from ARP - in my OnBegin I check for certain processes and if they are running they need to be shut down and the system rebooted before the uninstall can try again. I'm trying to set up RunOnce to restart the uninstall after reboot and need to pass it everything from the original commandline used by the ARP call. I know I'm probably missing something obvious, but at the moment I'm coming up empty.
Can anyone enlighten me? Thanks.
Can anyone enlighten me? Thanks.
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 03, 2010
08:09 AM
Try using the environment variable %CMDCMDLINE%. It returns the exact command line used to start the current cmd.exe.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2010
08:14 AM
I tried:
and I get the "unable to find" message. So it appears that the CMDCMDLINE env var does not exist when the script is running. I'm guessing that is why the /z parameter exists to pass info to CMDLINE - but that doesn't help me since I'm trying to replicate the entire command line used to start setup.exe.
if (GetEnvVar("CMDCMDLINE", svTemp)<0) then
MessageBox("Unable to find env var CMDCMDLINE", INFORMATION);
else
MessageBox("CMDCMDLINE : "+svTemp+":", INFORMATION);
endif;
and I get the "unable to find" message. So it appears that the CMDCMDLINE env var does not exist when the script is running. I'm guessing that is why the /z parameter exists to pass info to CMDLINE - but that doesn't help me since I'm trying to replicate the entire command line used to start setup.exe.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2010
08:57 AM
I haven't tried it, but perhaps the GetCommandLine API function? Something like:
prototype STRING Kernel32.GetCommandLineA( );
function OnBegin( )
begin
MessageBox(GetCommandLineA( ), INFORMATION);
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2010
09:12 AM
Thanks - looks like that should do it.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 02, 2010
05:43 PM
I mistakenly put my post in 'IS2010 Express', what I want to know is how to get the commandline information in Basic MSI project (the commandline executs setup.exe).
Thanks
Thanks
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)