Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行独立的Windows Powershell_Windows_Powershell - Fatal编程技术网

运行独立的Windows Powershell

运行独立的Windows Powershell,windows,powershell,Windows,Powershell,我的应用程序依赖于PowerShell版本5。但是一些旧的windows系统没有安装与我们的应用程序运行的版本相同的版本。那么有没有办法运行我放在应用程序文件夹中的独立PowerShell呢。因此,我的应用程序不依赖于系统PowerShell。否。您的应用程序不能有可移植版本的Windows PowerShell 您也可能无法在较旧的操作系统上安装较新版本;e、 例如,无法在Windows XP上安装PowerShell版本5 Windows Powershell版本取决于许多因素,例如OS版本

我的应用程序依赖于PowerShell版本5。但是一些旧的windows系统没有安装与我们的应用程序运行的版本相同的版本。那么有没有办法运行我放在应用程序文件夹中的独立PowerShell呢。因此,我的应用程序不依赖于系统PowerShell。

否。您的应用程序不能有可移植版本的Windows PowerShell

您也可能无法在较旧的操作系统上安装较新版本;e、 例如,无法在Windows XP上安装PowerShell版本5

Windows Powershell版本取决于许多因素,例如
OS版本
Microsoft.NET Framework
Windows管理框架
WS-Management
Windows管理工具
公共语言运行时
图形用户界面要求

以下是有关Windows PowerShell版本及其要求的详细信息

我认为最好是创建应用程序,使其与最旧版本的PowerShell兼容。这可能既困难又棘手,但这是确保正确向后兼容性的唯一方法。

免责声明:我们不知道您的应用程序,也不知道为什么它依赖于PowerShell。 此外,我们不知道它是依赖于Windows PowerShell还是一般的PowerShell。我们也不知道它是否需要特别的版本5,或者是否会在更新的版本中运行


要回答您问题的核心:

那么有没有办法运行我放在应用程序文件夹中的独立PowerShell呢

是的,有! 微软推出了这个版本,它最初是一个分支,是一个跨平台的版本,运行在Windows、macOS和主要的Linux发行版上。您可以下载PowerShell二进制归档文件,提取它们,然后运行
pwsh.exe

请注意:
虽然它提供了大量众所周知的PowerShell cmdlet和一些(大多数)Windows PowerShell行为,但了解PowerShell Core和Windows PowerShell之间的区别很重要。有关更多信息,请参阅存储库的自述文件。

长话短说-否。您不能使用“便携式”powershell。是否尝试使用?它确实是“可移植”的,但不是Windows PowerShell版本5。请注意,他们可能不使用PowerShell外壳,而是使用应用程序中托管的PowerShell自动化技术,在这种情况下,
pwsh.exe
与此注释无关。Thx。我只是“假设”,应用程序由一些ps1文件组成。OP没有说太多。谢谢,@Clijsters,它起作用了。但是Get Counter命令不起作用。所以,任何在Powershell core中运行此命令的解决方案。您的答案都是正确的,但您的anwer似乎没有考虑Powershell core。