PowerShell có hoạt động trên các hệ điều hành khác ngoài Windows không?

Mục lục:

PowerShell có hoạt động trên các hệ điều hành khác ngoài Windows không?
PowerShell có hoạt động trên các hệ điều hành khác ngoài Windows không?

Video: PowerShell có hoạt động trên các hệ điều hành khác ngoài Windows không?

Video: PowerShell có hoạt động trên các hệ điều hành khác ngoài Windows không?
Video: Sửa lỗi Windows màn hình xanh hoặc treo logo CHUẨN NHẤT 2023 - YouTube 2024, Tháng tư
Anonim
Nó có thể rất bực bội khi giáo sư của bạn nói một điều về PowerShell và các trang web khác nhau dường như cung cấp bằng chứng vững chắc ngược lại. PowerShell có thực sự hoạt động trên các hệ thống không phải của Windows hay không? Bài đăng Hỏi và Đáp của người dùng siêu nhân hôm nay có câu trả lời cho câu hỏi của người đọc khó hiểu.
Nó có thể rất bực bội khi giáo sư của bạn nói một điều về PowerShell và các trang web khác nhau dường như cung cấp bằng chứng vững chắc ngược lại. PowerShell có thực sự hoạt động trên các hệ thống không phải của Windows hay không? Bài đăng Hỏi và Đáp của người dùng siêu nhân hôm nay có câu trả lời cho câu hỏi của người đọc khó hiểu.

Phiên Hỏi & Đáp hôm nay đến với chúng tôi theo lịch sự của SuperUser - một phân khu của Stack Exchange, một nhóm các trang web Hỏi & Đáp do cộng đồng điều hành.

Câu hỏi

Trình đọc siêu người dùng FredSavage187 muốn biết liệu PowerShell có hoạt động trên các hệ điều hành khác ngoài Windows không:

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 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 có hoạt động trên các hệ điều hành khác ngoài Windows không?

Câu trả lời

Người đóng góp SuperUser Ben N có câu trả lời cho chúng tôi:

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 distributions are supported. For example, here are the instructions for Ubuntu and a demonstration:

Image
Image

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).

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.

Có cái gì để thêm vào lời giải thích? Tắt âm thanh trong các ý kiến. Bạn muốn đọc thêm câu trả lời từ những người dùng Stack Exchange có hiểu biết công nghệ khác? Xem toàn bộ chuỗi thảo luận tại đây.

Hình ảnh tín dụng: Jeff Hicks (Petri IT Knowledgebase)

Đề xuất: