【问题标题】:Change Windows 10 text size (DPI) programatically without restart以编程方式更改 Windows 10 文本大小 (DPI),无需重新启动
【发布时间】:2017-11-21 12:16:13
【问题描述】:

我需要一个程序,将 Win 10 设置中的文本大小滑块的值拖动到 100%(或其他一些参数化值)。

这里描述了一些方法:Change windows dpi setting C#。但是需要重新启动才能应用注册表更改。我正在寻找无需重新启动即可更改 Win 10 DPI 的脚本。

我希望在 C# 或 PowerShell 中完成此操作,最好不要使用任何大型链接外部库。这可能吗?

【问题讨论】:

标签: c# powershell windows-10 dpi


【解决方案1】:

(因打字错误而编辑) 电源外壳。确保设置执行策略。

#Load ntuser.dat
reg load HKU\UserProfile C:\users\UserProfile \NTUSER.DAT

# Create a new key, close the handle, and trigger collection
Set-ItemProperty -Path 'Registry::HKU\UserProfile\Control Panel\Desktop' -Name 'DPIScalingVer' -Value 60

#Unload ntuser.dat
reg unload HKU\UserProfile 

【讨论】:

  • 返回Set-ItemProperty : Cannot find path 'HKU\UserProfile \Control Panel\Desktop' because it does not exist. 字符串中可能有多余的空格。也许还有一些解释为什么这应该会很方便。
  • 即使在执行PowerShell.exe -ExecutionPolicy UnRestricted -File .\install\test.ps1 并删除多余的空格后,它仍显示Set-ItemProperty : Cannot find path 'HKU\UserProfile\Control Panel\Desktop' because it does not exist
  • 您是否尝试过进入 regedit 并验证您是否拥有注册表项?我在 Win10 上的版本中有密钥。另外,我注意到我的 PowerShell 中有一个输入错误。我不小心在 UserProfile 后面加了一个空格。你删除了那个空间吗?
猜你喜欢
  • 2012-10-27
  • 1970-01-01
  • 1970-01-01
  • 2016-04-25
  • 1970-01-01
  • 2016-03-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多