Reputation: 796
I cannot run PowerShell.exe interactively in a Cygwin rxvt or mintty terminal. Seems any session using a /dev/tty? or /dev/pts? pseudo terminal device. An instance using the junky windows console device /dev/console or /dev/cons? will work.
cygstart /bin/bash -li
launches the console version in the cruddy Windows Command Prompt which is the only place I can get an interactive PowerShell.
Works. Rxvt doesnt:
Nor does mintty:
I've tried all the echo -e | powershell.exe
and powershell.exe </dev/null
I'm assuming when I see answers on Stackoverflow on this they are using Console's ... or am I missing something?
Why I cannot run PowerShell 2 from Cygwin? seems to run fine, just gets powershell v3 when he wants v2 ... wish I had that problem.
I've developed a powershell wrapper to call powershell scripts and commands from a Cygwin terminal session but cannot get the interactive option to work (if you give the wrapper no script or commands then you want to go interactive). see https://bitbucket.org/jbianchi/powershell/wiki/ for info on the wrapper script. It works for most powershell.exe calls and even acts like a "she-bang" if used in the first line of the ps1 script.
Upvotes: 5
Views: 9466
Reputation: 1823
First Install cygwin in your system. After that type bash on powershell terminal and you can access cygwin terminal.
PS C:\Users\username\1and1> bash
username@LWMT-14R25Q2:/mnt/c/Users/username/1and1$
Upvotes: 1
Reputation: 1
Script for running powershell on Cygwin minty:
blahblah@blahblahbin $ cat pwrshl
#!/usr/bin/bash if [[ ! -f "$1" ]] then
echo "Usage: $0 <PowerShellScriptFile>"
exit fi
echo "\n" | powershell -Command "& {$(<$1)}"
Upvotes: -2
Reputation: 796
The solution I've found is to use http://sergeybelous.com/ (main site) Proxy32 proxywinconsole.exe
program. If this program is in the path, my poweshell.bash wrapper will call it which will let you work interactively with PowerShell.
Upvotes: 1
Reputation: 1199
If you need to run powershell inside cygwin/babun, follow https://code.google.com/p/mintty/issues/detail?id=56#c64 . Bascilly, downloard or compile https://github.com/rprichard/winpty, copy it to your $PATH and then run
console.exe powershell
This also works with batch scripts that invoke powershell inside.
Upvotes: 1
Reputation: 304
I'm afraid I can't answer your question, but maybe I can help you a little further on your way with this:
I believe this is related to this issue, as discussed on the MinTTY Issue #56. It goes into great detail as to how common cmd.exe shell applications work and interact, so much as they detail how common unix applications using their TTY abstraction layer work differently than Windows command line applications.
Upvotes: 0