Collecting command-line arguments
To accept command-line arguments passed to your UI, use the Command.GetCommandLineArgs
method, accessible via the BootstrapperApplication
class. For example, we could add a method to our model class called GetCommandLine
, like so:
public string[] GetCommandLine() { return this.BootstrapperApplication.Command .GetCommandLineArgs(); }
Internally, this method will call the
GetCommandLineArgs
method, which returns an array of strings. Each index in the array will contain one of the arguments passed to the bootstrapper. If the user were then to pass an argument called "foo" to our executable, such as:
MyBootstrapper.exe /foo
Then /foo
would be stored in the string array. Note, however, that the Burn engine intercepts some common command-line arguments and stores them in the Command
object's Action
property. We would use the Action
property to access these arguments. For example, if the user passed /?
, which is commonly known to be a request for a help...