为什么我不能从Cygwin运行PowerShell 2? [英] Why I cannot run PowerShell 2 from Cygwin?
问题描述
我安装了PowerShell 3,我需要从Cygwin运行PowerShell 2
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
但是你看到它仍在运行PowerShell 3。
But as you see it is still running PowerShell 3.
你有什么想法我做错了什么?
Do you have any ideas what am I doing wrong?
如果你好奇为什么我需要从Cygwin运行PowerShell,我写的git钩子。
开发服务器端钩子我写了PowerShell脚本,由于上面描述的问题,我不能用断点的好办法。
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:在Windows 8上使用Cygwin 1.7.11终端
UPD: I am using Cygwin 1.7.11 terminal on Windows 8
UPD:我甚至可以在其间运行cmd,以确保参数传递正确
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
推荐答案
>
您可能需要提供更多的上下文来查看为什么这不工作。只有我能想到的原因是 -Version 2.0
param没有传递给powershell。
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.
这篇关于为什么我不能从Cygwin运行PowerShell 2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!