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 see it is still running PowerShell 3.
Do you have any ideas what am I doing wrong?
If you curious why I need to run PowerShell from Cygwin, it is because of the git hooks I am writing. To develop server-side hooks I write PowerShell script, and because of the problem described above, I cannot use my nice trick with breakpoints
UPD: I am using Cygwin 1.7.11 terminal on Windows 8
UPD: I can even run cmd in between to make sure that parameters are passed properly
$ 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
Works as expected for me.
You might have to give more context to see why this is not working. Only reason I can think of is somehow the -Version 2.0
param is not being passed to powershell.