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
  • 閱讀 ( 29 )
  • 分類:網際網路

你可能感興趣的文章

雙引導作業系統的10個風險

...安裝第二個作業系統,並想知道風險?在你的電腦上安裝Windows和Linux可以讓你兩全其美。但這並不總是一帆風順的。雙重啟動可能會導致問題,其中一些問題很難預見。 ...

  • 發佈於 2021-03-11 01:07
  • 閲讀 ( 61 )

如何在沒有瀏覽器的情況下使用web

... 使用Windows PowerShell和FTP下載檔案非常簡單。只需輸入ftp命令,然後使用: ...

  • 發佈於 2021-03-11 17:22
  • 閲讀 ( 61 )

如何保護windows免受崩潰和幽靈般的安全威脅

... 謝天謝地,微軟釋出了一個方便的PowerShell指令碼,您可以在您的系統上執行。按照下面的步驟,您可以在系統上安裝和啟用一個附加模組。結果將表明您是否需要採取進一步步驟。 ...

  • 發佈於 2021-03-11 17:49
  • 閲讀 ( 52 )

萬神殿解釋:看看極簡基本作業系統桌面

...過去的五年中積累了數百萬的下載量,其中許多來自執行Windows或macOS的計算機。初級作業系統在一定程度上關注細節,使其區別於其他版本的Linux。 ...

  • 發佈於 2021-03-11 21:24
  • 閲讀 ( 62 )

你的電腦有特殊用途嗎?使用此linux作業系統

與Windows和macOS不同,Linux是你自己做的。您可以交換作業系統的哪些部分幾乎沒有限制。因此,您可以自由安裝任何Linux作業系統,並將其調整到您的夢想機器中。 ...

  • 發佈於 2021-03-12 12:25
  • 閲讀 ( 66 )

如何使用hyper-v在windows 10上執行任何linux發行版

... 有幾種安裝Hyper-V的方法,都非常簡單。最簡單的是PowerShell和Windows功能。 ...

  • 發佈於 2021-03-14 05:09
  • 閲讀 ( 54 )

7個簡單的windows指令碼,為您節省時間和精力

... 使用powershell編寫指令碼 ...

  • 發佈於 2021-03-15 21:37
  • 閲讀 ( 56 )

如何在linux上安裝和使用powershell

Windows PowerShell是一個優秀的配置管理和自動化框架。它由命令列shell和基於.NET的指令碼語言組成。管理員使用PowerShell作為管理Windows、Linux和網路客戶端的一種手段。 ...

  • 發佈於 2021-03-16 02:34
  • 閲讀 ( 53 )

如何使用windows 10 hyper-v建立虛擬機器

... 確保Hyper-V正確安裝的最簡單方法是使用PowerShell。(PowerShell和命令提示符有什麼區別?)也可以選擇使用Windows功能安裝Hyper-V,但這並不總是正常工作。 ...

  • 發佈於 2021-03-20 04:49
  • 閲讀 ( 59 )

為什麼windows提供linux核心會改變一切

...中執行混合任務外,在同一終端視窗的不同選項卡中使用Powershell for Windows和Bash for Linux的能力也將改變跨平臺開發人員的一切。 ...

  • 發佈於 2021-03-20 05:49
  • 閲讀 ( 52 )
kq920478
kq920478

0 篇文章

作家榜

  1. admin 0 文章
  2. 孫小欽 0 文章
  3. JVhby0 0 文章
  4. fvpvzrr 0 文章
  5. 0sus8kksc 0 文章
  6. zsfn1903 0 文章
  7. w91395898 0 文章
  8. SuperQueen123 0 文章