博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PowerShell是否可以在Windows以外的其他操作系统上运行?
阅读量:2509 次
发布时间:2019-05-11

本文共 3467 字,大约阅读时间需要 11 分钟。

It can be very frustrating when your professor says one thing about PowerShell and various websites seem to offer solid proof to the contrary. Does PowerShell actually work on non-Windows systems or not? Today’s SuperUser Q&A post has the answer to a puzzled reader’s question.

当您的教授对PowerShell发表一件事而各种网站似乎提供了相反的可靠证据时,这可能会非常令人沮丧。 PowerShell是否可以在非Windows系统上正常工作? 今天的《超级用户问答》帖子解答了一个困惑的读者的问题。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

问题 (The Question)

SuperUser reader FredSavage187 wants to know if PowerShell works on other operating systems besides Windows:

超级用户读者FredSavage187想知道PowerShell是否可以在Windows以外的其他操作系统上运行:

My computer science professor recently gave us a quiz and one of the questions was, “True or False: PowerShell works on Windows, Mac, and Linux”. The correct answer was “false” and he maintains that PowerShell is a Windows only thing. But I found a couple of websites that say otherwise:

我的计算机科学教授最近给我们进行了一个测验,其中一个问题是:“对还是错:PowerShell可以在Windows,Mac和Linux上运行”。 正确答案是“假”,他坚持认为PowerShell仅是Windows。 但是我发现有两个网站另有说明:

[Microsoft Azure Blog]

[Microsoft Azure博客]

[GitHub]

[GitHub]

Which one is actually correct? Does PowerShell work on Linux and Mac OS as well as Windows?

哪一个是正确的? PowerShell是否可以在Linux和Mac OS以及Windows上运行?

Does PowerShell work on other operating systems besides Windows?

PowerShell是否可以在Windows以外的其他操作系统上运行?

答案 (The Answer)

SuperUser contributor Ben N has the answer for us:

超级用户贡献者Ben N为我们提供了答案:

Yes. Much of PowerShell is .NET, so it can run on any operating system that has the Common Language Runtime (CLR). On Windows, that is the .NET Framework. For other operating systems, including Linux, you can use the , an open-source, cross-platform subset of the .NET Framework.

是。 PowerShell大部分是.NET,因此它可以在具有公共语言运行时(CLR)的任何操作系统上运行。 在Windows上,这就是.NET Framework。 对于包括Linux在内的其他操作系统,可以使用 (.NET Framework的开源,跨平台子集)。

As you learned at the PowerShell repository on GitHub, quite a few operating systems and distributions are supported. For example, here are the and a :

正如您在GitHub上的PowerShell存储库中了解到的那样,支持许多操作系统和发行版。 例如,这是的和一个 :

One could argue that not all of PowerShell is available in non-Windows environments since some features depend on libraries found only in Windows. The ParsedHtml property on the HtmlWebResponseObject type returned by Invoke-WebRequest, for example, is only useful on Windows because it holds a COM object that comes from an unmanaged library, mshtml.dll to be specific. On other platforms, there is nothing there. And, of course, there are cmdlets to manage systems found only in Windows, like Modern apps (Get-AppxPackage, for example).

有人可能会说,并非所有PowerShell都可以在非Windows环境中使用,因为某些功能取决于仅在Windows中找到的库。 例如,由Invoke-WebRequest返回的HtmlWebResponseObject类型的ParsedHtml属性仅在Windows上有用,因为它包含来自非托管库(具体为mshtml.dll)的COM对象。 在其他平台上,没有任何东西。 而且,当然,有cmdlet可以管理仅在Windows中找到的系统,例如Modern应用程序(例如Get-AppxPackage )。

Still though, the PowerShell infrastructure works perfectly well on other operating systems, plenty of the cmdlets are usable anywhere, and support is only getting better.

尽管如此,PowerShell基础结构在其他操作系统上也能很好地运行,许多cmdlet都可以在任何地方使用,并且支持只会越来越好。



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? .

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 。

Image Credits:

图片来源:

翻译自:

转载地址:http://hcfwd.baihongyu.com/

你可能感兴趣的文章
JavaScript——JS上下文中的this值笔记
查看>>
Bootstrap简单使用
查看>>
导航控制器的出栈
查看>>
玩转CSS3,嗨翻WEB前端,CSS3伪类元素详解/深入浅出[原创][5+3时代]
查看>>
iOS 9音频应用播放音频之播放控制暂停停止前进后退的设置
查看>>
Delphi消息小记
查看>>
HNOI2016
查看>>
BZOJ2648: SJY摆棋子&&2716: [Violet 3]天使玩偶
查看>>
JVM介绍
查看>>
结构体,联合体,内存分配
查看>>
JVM垃圾收集器介绍
查看>>
[No0000136]6个重要的.NET概念:栈,堆,值类型,引用类型,装箱,拆箱
查看>>
【转】MapReduce源码分析总结
查看>>
原生JDK网络编程- NIO之Reactor模式
查看>>
table01
查看>>
简洁侧边wordpress博客模板
查看>>
linux及安全第四周总结——20135227黄晓妍
查看>>
搞出来,PHP mysql JQuery 二级联动
查看>>
AviSynth入门与应用指南
查看>>
ubuntu14.04安装GoldenDict
查看>>