Visual Studio 2012 - several commands in command line arguments

In visual studio 2012, you can specify command line arguments in the debug-> start parameters. I am working on a powershell cmdlet, so I would like to parse several commands in powershell. My arguments look like this:

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

the problem is that it treats the command as 1 long line ie -command "add-pssnapin Registerv2.0 -command New-Token -command www.google.com", and not 3 seperae commands. Does anyone know how to change this:

change the results I'm looking for when I run a project

  • power shell opens

  • my snapin is registered

  • Call the new cmdlet token

  • enter cmdlet parameters
+4
source share
1 answer

If you first want to add-pssnapin Registerv2.0 and then call New-Token , you must link them one at a time, for example:

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

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

For example, New-Item will expect a list of paths and type as input, both can also be provided on the command line as parameters. For instance:

 New-Item foo -type directory 

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

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

Source: https://habr.com/ru/post/1489926/


All Articles