为什么会这样:
$RegistryKeys = (Get-ChildItem
HKLM:\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList)
foreach ($subKey in $RegistryKeys) {$subKey.GetValue("FriendlyName")}
返回这个(星号包围的文本是乱码):
Corp **j** LitwareInc Perimeter External **䑀** LitwareInc Perimeter Internal **䑀** LitwareInc Perimeter2 External LitwareInc Perimeter2 Internal
最佳答案
这不是胡言乱语。它们是多字节 Unicode 字符,无法在 cmd 窗口中正确显示。
参见 this question 的第二个答案寻求解决方案。
关于.net - Powershell GetValue 返回乱码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7198753/