Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com 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.

add comment

1 Answer

Do you get a confirmation message like this one:

Confirm
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
add comment

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