我在 Windows Server 2012 R2 上使用版本为 1.49.0 的 VSCode 用户安装版,用于 PowerShell 开发。在我的 Windows 10 笔记本电脑上没有这个问题,但在服务器上需要进行开发工作,因为我编写代码针对的是 SharePoint 2013 的本地对象模型。
我已经安装了 Windows8.1-KB3118401 补丁,但启动控制台时出现以下错误:
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', 'Import-Module 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <===== " -LogLevel 'Normal' -LogPath 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1599836315-05dc7ac0-e011-4b28-8568-c8782ebeabc01599836314391\EditorServices.log' -SessionDetailsPath 'c:\Users\first.last.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-8808-389325' -FeatureFlags @() ...
当我尝试运行一个 hello world 测试脚本时,出现以下错误:
在 PowerShell 会话启动之前,请勿调试或运行 PowerShell 脚本。请等待 PowerShell 会话启动完成,然后再次尝试。
来源:PowerShell Preview (Extension)
看起来似乎与微软的 Powershell 2020.6.0 扩展有关,因为只要启用它就会抛出错误。
有什么方法可以让我的 Powershell 工作正常吗?
"powershell.integratedConsole.suppressStar
谢谢。 - Jeetcu