Why can't I start PowerShell 2 from Cygwin?

I have PowerShell 3 installed and I need to run PowerShell 2 from Cygwin

$ PowerShell -Version 2
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Michael> $host.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1

But, as you can see, PowerShell 3 still works.

Do you have any idea what I'm doing wrong?

If you're wondering why I need to run PowerShell from Cygwin, this is because of the git hooks I am writing. To develop server side hooks, I am writing a PowerShell script, and due to the problem described above, I cannot use my good trick with breakpoints

UPD: I am using Cygwin 1.7.11 terminal on Windows 8

UPD: I can even run cmd between them to make sure the parameters are passed correctly

$ cmd
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Michael>PowerShell -Version 2
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Michael> $host.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1
+1
source share
2 answers

It works as expected for me.

enter image description here

, , . , , - , -Version 2.0 powershell.

0

, Cygwin Powershell.exe, ? , Powershell.exe. WMI Win32_Process. Powershell, . , Cygwin pid . ,

gwmi win32_process -filter "Name = 'powershell.exe'" | select commandline, processid, parentprocessid | ft -AutoSize
0

All Articles