powershell在windows以外的其他操作系统上工作吗?

当你的教授对PowerShell说了一句话,而各种网站似乎提供了确凿的证据来证明这一点时,你会感到非常沮丧。PowerShell是否在非Windows系统上工作?今天的超级用户问答帖子回答了一位困惑的读者的问题。...

powershell在windows以外的其他操作系统上工作吗?

当你的教授对PowerShell说了一句话,而各种网站似乎提供了确凿的证据来证明这一点时,你会感到非常沮丧。PowerShell是否在非Windows系统上工作?今天的超级用户问答帖子回答了一位困惑的读者的问题。

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

问题

超级用户读者FredSavage187想知道PowerShell是否适用于除Windows以外的其他操作系统:

My computer science professor recently gave us a quiz and one of the questi*** 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 is open sourced and is available on Linux [Microsoft Azure Blog]

PowerShell Repository [GitHub]

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

PowerShell在Windows以外的其他操作系统上工作吗?

答案

超级用户贡献者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 CoreCLR, an open-source, cross-platform subset of the .NET Framework.

As you learned at the PowerShell repository on GitHub, quite a few operating systems and distributi*** are supported. For example, here are the instructi*** for Ubuntu and a dem***tration:

007Ys3FFgy1gpbjgmhgquj30hd07dwfk

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 HtmlWebResp***eObject 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).

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.


有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。

图片来源:Jeff Hicks(Petri IT知识库)

  • 发表于 2021-04-07 22:15
  • 阅读 ( 192 )
  • 分类:互联网

你可能感兴趣的文章

如何在没有浏览器的情况下使用web

...下载——微软、Canonical、育碧和其他公司都使用它来分发操作系统和软件安装程序文件。 ...

  • 发布于 2021-03-11 17:22
  • 阅读 ( 264 )

如何保护windows免受崩溃和幽灵般的安全威胁

... 这些bug可以攻击所有的桌面操作系统,但在本文中,我们将只关注Windows。让我们仔细看看这些漏洞是如何工作的,以及如何判断它们是否影响了您。 ...

  • 发布于 2021-03-11 17:49
  • 阅读 ( 285 )

如何使用hyper-v在windows 10上运行任何linux发行版

... 你是在安装了操作系统的电脑上读的。在很大程度上,计算机就是这样做的:创建一个包含的环境,用户可以通过它查看、编辑和运行文件。然而,很少有人会在一台计算机上使用两个...

  • 发布于 2021-03-14 05:09
  • 阅读 ( 359 )

使用powershell而不是批处理脚本的5个原因

...这是个好消息?因为你的PowerShell知识将不再局限于一个操作系统。批处理脚本只能在Windows上运行(或者通过Wine在Linux上运行,我们不建议这样做),因此它是有限制的,而PowerShell现在可以帮助您扩展专业知识。 ...

  • 发布于 2021-03-15 16:49
  • 阅读 ( 285 )

7个简单的windows脚本,为您节省时间和精力

... 安装Windows10有很多好处,但可以公平地说,操作系统(OS)附带了几个应用程序,这些应用程序都符合bloatware的要求。我们可以为我们设置一个脚本,而不是手动删除这些软件片段。 ...

  • 发布于 2021-03-15 21:37
  • 阅读 ( 289 )

如何在linux上安装和使用powershell

...Red Hat Enterprise Linux 7和CentOS 7以及macOS的安装程序。从下载操作系统的正确安装程序开始。我运行的是ubuntu16.04,所以我下载了ubuntu16.04deb。不过,安装程序应该适用于任何Ubuntu派生工具,如Lubuntu和Xubuntu。 ...

  • 发布于 2021-03-16 02:34
  • 阅读 ( 307 )

如何在Windows10上检查您的windows体验分数

... 2使用windows powershell ...

  • 发布于 2021-03-17 21:40
  • 阅读 ( 336 )

如何在windows10上获得linux bash shell

...到列出的系统类型;对于Windows Subsystem for Linux,应为64位操作系统。 ...

  • 发布于 2021-03-21 11:48
  • 阅读 ( 284 )

如何在windows10中修复错误代码0x8000ffff

... 在“开始”菜单搜索栏中键入Powershell,然后右键单击最佳匹配项并选择“以管理员身份运行”。 复制并粘贴以下命令:powershell ExecutionPolicy Unrestricted Add AppxPackage DisableDevelopmentMode Register...

  • 发布于 2021-03-21 16:10
  • 阅读 ( 363 )

如何轻松地从Windows10中删除臃肿软件

...。Windows10Debroader是由Syncex开发的PowerShell脚本。它几乎从操作系统中删除几乎每一个Windows10包,并将其剥离。但是,在这一点上,它还删除了您可能会发现有用的应用程序,例如TuneInRadio、PowerBI或Windows Netflix应用程序。 ...

  • 发布于 2021-03-22 17:00
  • 阅读 ( 375 )
kq920478
kq920478

0 篇文章

相关推荐