我在我的 Mac 上使用 Parallels 来运行 Windows 8.1 操作系统。 Parallels 有一个怪癖,每次重新启动时都会将屏幕分辨率重置为最高级别。因此,我想编写一个简短的 Powershell 脚本,自动将我的屏幕分辨率设置为我喜欢的分辨率。问题是,使用 Set-ScreenResolution
或 Set-DisplayResolution
会出现以下错误:
Set-DisplayResolution : The term 'Set-DisplayResolution' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Set-DisplayResolution + ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Set-DisplayResolution:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
知道为什么会这样吗?
我使用的是 Windows 8.1 64 位。我的Powershell版本是4.0。我在 Yosemite 操作系统 (mac) 上使用 Parallels 9 作为我的虚拟机。
最佳答案
Get-DisplayResolution
和 Set-DisplayResolution
仅在 Server Core 上可用。
网络搜索指向这个article显示如何从 PowerShell 调用适当的 user32 函数。它有望为您指明正确的方向。
关于windows - 为什么我的 Powershell 中的 Set-DisplayResolution 命令不见了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28817636/