我正在尝试将一些脚本从 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.