0

我正在尝试将一些脚本从 poweshell 5.0 移植到新的 pwsh powershell 6,我注意到不再有 -sta 参数。如何设置 pwsh 的 ApartmentState?我找不到任何关于它的东西,看起来它在编译时被定义为 mta 或 sta ,具体取决于目标平台。我对吗?

C:\WINDOWS\system32>pwsh -sta
The argument '-sta' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

C:\WINDOWS\system32>powershell -sta
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
4

1 回答 1

0

由于...核心组件旨在跨多个平台工作,我认为您会发现不包括特定于 Windows 的概念。如果您需要跨平台兼容性,您将需要找到另一种方式。如果您不使用 powershell 并意识到随着 pwsh 的前进,它会在可用功能方面慢慢落后。

于 2018-12-19T13:41:44.557 回答