I am using console as my tool for managing mercurial repositories. Wtih classic cmd or Console2 I type:
hg in
And console prompts something like:
D:\workspace\someproject>hg in
http authorization required
realm: Bitbucket.org HTTP
user: xorty
password:
And obviously, I type password.
But when I type "hg in" in powershell console, it doesn't prompt anything. It just keeps saying this:
Running script / selection. Press Ctrl + Break to stop
Can I make PowerShell ISE behave like classic console, or this isn't the way PowerShell is meant to work?
The Read-Host cmdlet reads a line of input from the console (stdin). You can use it to prompt a user for input. Because you can save the input as a secure string, you can use this cmdlet to prompt users for secure data, such as passwords.
To get the Prompt function, use the Get-Command cmdlet or use the Get-Item cmdlet in the Function drive. To get the script that sets the value of the prompt, use the dot method to get the ScriptBlock property of the Prompt function.
Cause. This is caused by the user (or system) PATH environment variable not containing the directory where the PowerShell executable resides. It's usually located at C:\Windows\System32\WindowsPowerShell\v1.
There are cmdlet for console input and output using PowerShell. In Windows Powershell, the input and output are given through the Host. It uses 'Write-Host' to print and 'Read-Host' to get input from console.
The PowerShell ISE indeed does not support console applications that require interactive input. The linked blog entry details options how to deal with that.
Since the PowerShell ISE is not a console, normal console applications cannot do everything they're used to, while of course PowerShell cmdlets can work just fine, since several things are dependent on the PowerShell host application (you get a graphical prompt with Read-Host, for example).
Console2 emulates a normal console by keeping the actual console around in a hidden window and polling it repeatedly for changes and, correspondingly, sending input to that window.
Powershell ISE ( integrated scripting environment ) is not the standard Powershell console. The ISE, like the name suggests, is a pretty basic GUI based script writing tool and doesn't support interactive console applications ( try just cmd
on the ISE console and see the error message)
Open powershell.exe, and run the command that you want. It will behave pretty much like cmd. Or alternatively, press CTRL+SHIFT+P in the ISE and run the command there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With