Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Probably a total noob question but:

When I run

Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardOutput ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log" -RedirectStandardError  ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log" -WindowStyle Hidden

I get the error

Start-Process : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:14
+ Start-Process <<<<  ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardOutput ".\packages\
PS-Get.0.1.0.0\NuGet.exe.Update.log" -RedirectStandardError  ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log" -WindowStyle Hidden
+ CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.StartProcessCommand

But all of:

Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardOutput ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log"

Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardError ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log"

Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -WindowStyle Hidden

Work fine... what am I missing??

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted
Get-Command -syntax Start-Process

gives two entries (manual wrapping added, and removing common parameters):

Start-Process [-FilePath] <String>
              [[-ArgumentList] <String[]>]
              [-Credential <PSCredential>]
              [-WorkingDirectory <String>]
              [-LoadUserProfile] [-NoNewWindow] [-PassThru]
              [-RedirectStandardError <String>] [-RedirectStandardInput <String>]
              [-RedirectStandardOutput <String>] [-Wait] [-UseNewEnvironment] 

Start-Process [-FilePath] <String>
              [[-ArgumentList] <String[]>]
              [-WorkingDirectory <String>] 
              [-PassThru]
              [-Verb <String>] [-Wait] 
              [-WindowStyle <ProcessWindowStyle>]

In your working cases specifying either -RedirectStandardOutput or -WindowStyle uniquely identifies which parameter set to use.

In your non-working case you have both of these parameters, but there is no parameter set that has both, hence PSH can't select one.

share|improve this answer
    
Ahhh I see. Thanks... so no way to run in a hidden window and redirect output then huh? –  JimmyP May 9 '11 at 11:35
    
@JimmyP: Not with the cmdlet (directly using [System.Diagnostics.Process] will allow more control, but unclear how easy to to the redirection at that level in PSH. Of course the combination of standard output and a GUI is pretty rare in Windows... –  Richard May 9 '11 at 12:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.