For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > February 2005 > Setup project command line arguments









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Setup project command line arguments
Trinidad

2005-01-03, 6:51 am

I have created a Setup Project using Visual Basic .NET.
I have no problem to create an installer copying my .exe into a specific directory and also to write into registries.
BUT I don't know how can I read command line arguments.
I must absolutely read the command line arguments and use this arguments for my installation.

Does anyone have an idea?

Thanks a lot
Trinidad.
Phil Wilson

2005-01-05, 3:59 pm

I'm not sure what you mean - the exe is a wrapper generated by Visual
Studio, and I don't know if you can pass command line arguments into it that
you can use. If you just create an MSI file, you can run it with a command
line such as:
msiexec /i <path to your msi> MYPROPERTY=something
and then the property MYPROPERTY can be referenced during the setup, in
conditions for installing files etc.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

"Trinidad" <Trinidad.1iafto@mail.codecomments.com> wrote in message
news:Trinidad.1iafto@mail.codecomments.com...
>
> I have created a Setup Project using Visual Basic .NET.
> I have no problem to create an installer copying my .exe into a
> specific directory and also to write into registries.
> BUT I don't know how can I read command line arguments.
> I must absolutely read the command line arguments and use this
> arguments for my installation.
>
> Does anyone have an idea?
>
> Thanks a lot
> Trinidad.
>
>
>
> --
> Trinidad
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>



Trinidad

2005-01-14, 11:41 am

The problem is my Setup.exe will be called from another existing application.
This application will call "Setup.exe param1" and I cannot change the way this application will call my Setup.exe.

I will like to know if there is a way to read this entry parameter (param1) into my Setup program.
Is there something I can change with a Custom Action?

The only solution I have found until know is to use an intermediary project that will analyze the command line parameter and save it into a registry. Then this project calls the Setup.exe without parameters.
Into the Setup project I add a Custom Action reading the parameter stored into the registry and then making the needed actions.
Do you think this is a good and only solution?

Thank you very much for your help

Trinidad Martinez.
ajb2222

2005-02-11, 4:49 pm

TO get command line arguments in .net use the command function

This example uses the Command function to return the command-line arguments in an object containing an array.

Function GetCommandLineArgs() As String()
' Declare variables.
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
Return args
End Function
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com