在 Windows Server 2008 R2 中安装 PowerShell 5.1 与中文脚本错误解决

通过以下命令查询当前 PowerShell 版本:

$PSVersionTable

首先需要安装 .NET Framework 4.5.2 或更高版本:https://dotnet.microsoft.com/en-us/download/dotnet-framework

然后下载安装 PowerShell 5.1:https://www.microsoft.com/en-us/download/details.aspx?id=54616

(内含 Windows 7 SP1、Windows Server 2008 R2 SP1、Windows 8.1、Windows Server 2012 R2 版本的升级安装包)

另一个更友好的下载地址:https://docs.microsoft.com/zh-cn/powershell/scripting/windows-powershell/wmf/setup/install-configure

 

如果在执行包含中文内容的脚本时不显示中文,或 Write-Output 中文时出错,如下图:

out-lineoutput : The Win32 internal error "A device attached to the system is not functioning" 0x1F occurred while writing to the console output buffer at the current cursor position. Contact Microsoft Customer Support Services.
+ CategoryInfo : WriteError: (:) [out-lineoutput], HostException
+ FullyQualifiedErrorId : WriteConsole,Microsoft.PowerShell.Commands.OutLineOutputCommand

  解决方案:

1、在标题栏中点击右键,选择“属性”:

 2、切换到字体选项卡,将原有默认点阵字体切换为上方字体:

 3、点击确定即可正常使用。

参考:https://blog.51cto.com/jameszhan/2642202

posted @   不是豆豆  阅读(1097)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
历史上的今天:
2020-03-01 如何在 asp.net core 中配合响应 html5 的音视频播放流,以及文件下载
友情链接:迷途


点击右上角即可分享
微信分享提示