powershell - Piping Read-Host does not wait for input -


i'm new powershell , want make tests. example command wait user input:

powershell -command "read-host test" 

but if i'm piping "read-host test" powershell not waited input. here how looks in shell:

ps f:\> powershell -command "read-host test" test: input input ps f:\> "read-host test" | powershell -command - test: ps f:\> 

does know why there difference on both commands?

try this

powershell -command "cat test.txt" | powershell -noexit -command - 

executes specified commands (and parameters) though typed @ windows powershell command prompt, , exits, unless noexit specified. value of command can "-", string. or script block.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -