Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Sometimes PowerShell stops sending output until I press enter. Why?

I am executing powershell commands like: powershell.exe "Get-Process java | Stop-Process" and when the command finishes it is requiring me to press Enter before returning me to the console.

Is there a way of executing a command so that I dont have to press enter to be returned to the console?

share|improve this question

migrated from Jul 20 '11 at 11:58

This question came from our site for professional and enthusiast programmers.

marked as duplicate by MDMarra, Ward, HopelessN00b, dunxd, Bryan Dec 14 '12 at 12:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Do you get a confirmation message like this one:

Are you sure you want to perform this action?
Performing operation "Stop-Process" on Target "java (xxxx)".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): 

Generally, you can suppress confirmations with this:

Get-Process java | Stop-Process -Confirm:$false
share|improve this answer
There is no confirmation dialog, and even a simple script like: powershell.exe -noprofile -NonInteractive -Command "exit 10" will not even exit after running. The console just hangs until I press enter. – Steven Jul 20 '11 at 23:18

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