zidsal
zidsal

Reputation: 587

visual studio 2012 multiple -commands in command line arguments

In visual studio 2012 it is possible on the debug-> start options to specify command line arguments. I am working on a powershell cmdlet so I'd like to be able to parse multiple commands into powershell. My arguments looks like this

-noexit -command add-pssnapin Registerv2.0 -command New-Token -command www.google.com

the problem is it is treating -command as 1 long string i.e -command "add-pssnapin Registerv2.0 -command New-Token -command www.google.com" rather then 3 seperae commands. Does anyone know how to change this:

edit the results I am looking for is when I run the project

  1. power shell opens

  2. my snapin is registered

  3. Call the cmdlet new-token

  4. enter in the cmdlet parameters

Upvotes: 4

Views: 2451

Answers (1)

Oliver Salzburg
Oliver Salzburg

Reputation: 22099

If you first want add-pssnapin Registerv2.0 and then New-Token to be called, you should chain them in one command, like so:

-command "add-pssnapin Registerv2.0; New-Token"

If New-Token expects a parameter, you should pass it on the command line directly, instead of trying to simulate user input.

For example, New-Item would expect a list of paths and a type as input, both can also be supplied on the command line as parameters. Like so:

New-Item foo -type directory

So, how you would pass the value www.google.com to New-Token depends on the name of the parameter. But could look like:

-command "add-pssnapin Registerv2.0; New-Token -tokenName www.google.com"

Upvotes: 1

Related Questions