繁体   English   中英

从 Powershell 5 远程 pc 运行 Powershell Core

[英]Run Powershell Core from Powershell 5 remote pc

我已经在远程 PC 上安装了 Powershell Core。

我已经通过 Powershell 5 进入到那台 PC 的远程会话。

当我跑

PowerShell -NoExit "pwsh-preview" 或只是 pwsh-preview

它显示了 Powershell 7 介绍并再次退出到 PS5(见下面的截图)

在此处输入图片说明

你没有展示你如何验证这种情况正在发生。

您所显示的只是快速返回。

启动您的会话,然后是 $PSVersionTable,然后键入 pwsh,然后再次键入 $PSVersionTable。

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.18362.628
PSEdition                      Desktop
PSCompatibleVersions           {...                                                                                 

pwsh

PowerShell 6.2.4
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS D:\Scripts> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.2.4
PSEdition                      Core
GitCommitId                    6.2.4
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {...

PS D:\Scripts> exit

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.18362.628
PSEdition                      Desktop
PSCompatibleVersions           {...

当您在它们之间切换时,您可以轻松更改您的个人资料,以在提示时向您显示您所在的版本。

根据你的评论...

没有像“pwsh”这样的命令,只有 pwsh-preview PSVersion 5.1.17763.771

你的说法是不正确的。 上面的屏幕输出是我的系统运行最新版本的 Powershell v7 的确切输出。

我对此并不陌生。 自从 PowerShell 作为 alpha 用户和内部人员被称为 PowerShell 之前,我就一直在使用它。

Monad 宣言——Windows PowerShell 的起源

以下是安装时创建的快捷方式的属性。

快捷方式标题

'PowerShell 6 (x64)' ---

快捷路径“C:\\Program Files\\PowerShell\\6\\pwsh.exe”-WorkingDirectory ~

您正在运行较早的预览版,而我正在运行当前版本。 因此差异。

在此处输入图片说明

https://github.com/PowerShell/PowerShell/releases

PowerShell-6.2.4-win-x64.msi

PowerShell-6.2.4-win-x64.msix

PowerShell-6.2.4-win-x64.zip

PowerShell-6.2.4-win-x86.msi

PowerShell-6.2.4-win-x86.zip

暂无
暂无

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

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