在 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
输了你,赢了世界又如何...
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有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 的音视频播放流,以及文件下载