简体   繁体   English

运行独立Windows Powershell

[英]Run Standalone Windows Powershell

My Application is dependent on PowerShell version 5. But some old windows system have not installed the same version where our application is running. 我的应用程序依赖于PowerShell版本5.但是一些旧的Windows系统没有安装我们的应用程序运行的相同版本。 So is there any way to run standalone PowerShell which I put in my application folder. 那么有没有办法运行我放在我的应用程序文件夹中的独立PowerShell。 So my application is not dependent on system PowerShell. 所以我的应用程序不依赖于系统PowerShell。

Disclaimer: We don't know your application and we don't know, why exactly it depends on PowerShell. 免责声明:我们不知道您的应用程序,我们不知道,为什么它取决于PowerShell。 Further we don't know if it depends on Windows PowerShell or on PowerShell in general. 此外,我们不知道它是否依赖于Windows PowerShell或PowerShell。 We also don't know if it requires specifically version 5 or would run in newer versions too. 我们也不知道它是否需要专门的版本5或者也会在更新的版本中运行。


To answer the core of your question: 回答你问题的核心:

So is there any way to run standalone PowerShell which I put in my application folder. 那么有没有办法运行我放在我的应用程序文件夹中的独立PowerShell。

Yes, there is! 就在这里!

Microsoft introduced PowerShell Core , which started as a fork and is a cross-platform edition that runs on Windows, macOS, and major Linux distros. 微软推出PowerShell Core ,它起初是一个分支,是一个跨平台版本,可在Windows,macOS和主要的Linux发行版上运行。 You can download PowerShell binary archives from GitHub , extract them and just run pwsh.exe . 您可以从GitHub下载PowerShell二进制存档,解压缩它们并运行pwsh.exe

Please beware: 请注意:

While it provides a huge amount of well-known PowerShell-cmdlets and some (most) of the Windows PowerShell behaviour, it is important to know the difference between PowerShell Core and Windows PowerShell. 虽然它提供了大量众所周知的PowerShell-cmdlet和一些(大多数)Windows PowerShell行为,但了解PowerShell Core和Windows PowerShell之间的区别非常重要。 Refer to the repository's README for further resources. 有关更多资源,请参阅存储库的自述文件。

No. You cannot have a portable version of Windows PowerShell for your application. 不可以。您的应用程序无法拥有可移植版本的Windows PowerShell。

You also may not be able to install a newer version on an older operating system; 您也可能无法在较旧的操作系统上安装较新版本; eg, you can't install PowerShell version 5 on Windows XP. 例如,您无法在Windows XP上安装PowerShell版本5。

Windows Powershell versions depend on many things, such as OS Version , Microsoft .NET Framework , Windows Management Framework , WS-Management , Windows Management Instrumentation , Common Language Runtime , Graphical User Interface Requirements . Windows Powershell版本依赖于许多内容,例如OS VersionMicrosoft .NET FrameworkWindows Management FrameworkWS-ManagementWindows Management InstrumentationCommon Language RuntimeGraphical User Interface Requirements

Here is a link with information about Windows PowerShell versions and their requirements. 以下是有关Windows PowerShell版本及其要求的信息的链接

I'd say it is best if you create your application so that it is compatible with the oldest possible version of PowerShell it will run with. 我认为最好是创建应用程序,以便它与将运行的最早版本的PowerShell兼容。 It could be hard and tricky, but it's the only to way to ensure proper backward compatibility. 它可能很难并且很棘手,但它是确保正确向后兼容性的唯一途径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM