use*_*939 21 scaling dpi windows-8.1
由于 Windows 8.1 不允许系统范围内的“Windows XP 风格”高 DPI 支持,我如何使 Microsoft 管理控制台应用程序 (mmc.exe) 具有高 DPI 感知能力?它没有“兼容性疑难解答”上下文菜单项。
Rod*_*oev 24
系统文件的兼容性选项卡是隐藏的,因此要复制“在高 DPI 设置下禁用显示缩放”复选框的功能,您需要将以下内容添加到注册表中:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\Windows\\System32\\mmc.exe"="~ HIGHDPIAWARE"
Run Code Online (Sandbox Code Playgroud)
这有一个额外的好处,即使所有 MMC 管理单元(如组策略编辑器)也使用本机缩放而不是模糊的光栅化版本。
您可以将其另存为 .reg 文件并导入,或使用以下命令粘贴到“运行”对话框中:
reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\System32\mmc.exe" /f /t REG_SZ /d "~ HIGHDPIAWARE"
如果您发现自己经常使用该解决方法,您可能希望将其添加到 .exe 文件的右键单击上下文菜单中。您还可以将其添加到 .msi 文件,因为这些文件也缺少兼容性选项卡:
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\exefile\shell\disabledpi]
[HKEY_CLASSES_ROOT\exefile\shell\disabledpi]
@="Disable DP&I Scaling"
[HKEY_CLASSES_ROOT\exefile\shell\disabledpi\command]
@="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"
"IsolatedCommand"="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"
[-HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]
[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]
@="Disable DP&I Scaling"
[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi\command]
@="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"
"IsolatedCommand"="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"
Run Code Online (Sandbox Code Playgroud)
由于“以管理员身份运行”和“禁用 DPI 缩放”设置存储在一起,因此在已设置为以管理员身份运行的文件上调用该命令将清除该标志并改为设置 DPI 缩放标志。这仅影响您手动选中该框的文件,而不影响其清单中具有正确 requestsExecutionLevel 的文件。
仅供参考,当两者都被检查时,字符串是“~ RUNASADMIN HIGHDPIAWARE”,但我不会把它放到上下文菜单选项中,因为它已经可以在上下文菜单上一次性使用了,这不是一个好主意管理员令牌很容易需要。
如果您想要禁用特定文件夹中可执行文件和安装程序文件的 DPI 缩放的选项,您可以使用以下 .reg 导入:
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\disabledpi]
[HKEY_CLASSES_ROOT\Directory\shell\disabledpi]
@="Disable DP&I Scaling"
[HKEY_CLASSES_ROOT\Directory\shell\disabledpi\command]
@="cmd /c @start /min cmd /c for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="cmd /c @start /min cmd /c for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
Run Code Online (Sandbox Code Playgroud)
在像 Program Files 这样的根级文件夹上使用该选项是一个坏主意,因为您将创建数百个注册表项。但在某些情况下,它是必不可少的,特别是对于 Process Explorer 和其余的 Sysinternals 实用程序或 Nirsoft 实用程序,所有这些实用程序都可以在禁用 DPI 缩放的情况下运行良好,但在其清单中没有明确指定的选项。
最后一批代码使用内部启动命令尽快让命令提示符窗口移开,并在解析文件夹内容时将其最小化。@符号用于防止在输出中回显命令,nul重定向用于隐藏输出“操作成功完成”。对于每个条目,因为它永远不会改变。
如果您碰巧拥有出色的 nircmd 工具,则可以完全隐藏命令提示符窗口的短暂闪烁:
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\exefile\shell\disabledpi]
[HKEY_CLASSES_ROOT\exefile\shell\disabledpi]
@="Disable DP&I scaling"
[HKEY_CLASSES_ROOT\exefile\shell\disabledpi\command]
@="nircmd.exe execmd reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="nircmd.exe execmd reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
[-HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]
[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]
@="Disable DP&I scaling"
[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi\command]
@="nircmd.exe execmd reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="nircmd.exe execmd @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
[-HKEY_CLASSES_ROOT\Directory\shell\disabledpi]
[HKEY_CLASSES_ROOT\Directory\shell\disabledpi]
@="Disable DP&I scaling"
[HKEY_CLASSES_ROOT\Directory\shell\disabledpi\command]
@="nircmd.exe execmd for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="nircmd.exe execmd for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
Run Code Online (Sandbox Code Playgroud)
如果 nircmd.exe 不在您的路径中,您可以在“系统环境变量”对话框中将其位置添加到上方或将其文件夹添加到您的路径中。要调出该窗口,您可以使用命令rundll32 sysdm.cpl,EditEnvironmentVariables
可以认为通过在运行时创建一个 .reg 文件并使用未记录的reg import /s
选项静默导入它来添加注册表项会更优雅。但根据我的经验,在运行时写入任何文件都会引发各种安全产品的警报,例如 COMODO Internet Securita、Panda、Norton 等的等效版本以及任何基于 HIPS 模型的产品。当上述工作正常时,我认为没有必要这样做,特别是如果您在多台计算机上使用它或共享它并且不想为其他人创建错误警报。
但是,如果您已经在使用 nircmd,那么使用它的regsetval
命令而不是reg add
.exe 和 .msi shell 扩展名是有意义的。文件夹选项仍然需要遍历目录列表以添加每个条目,因此它不适用于那些条目。PowerShell 和 VBScript 是选项,但它们的可用性取决于 Windows 的版本和许多其他变量。从安全角度来看,VBScript 作为漏洞利用载体享有盛誉,尤其是从 Internet 下载或在网络上共享时,如果没有明确设置 PowerShell 的执行策略以允许远程签名脚本,PS1 脚本根本不会运行。
如果您在使用该代码时发现任何奇怪的地方,请告诉我,因为它仍在进行中。话虽如此,它应该使配置 Windows 8.1 的 DPI 设置变得更加容易。
在 Windows 10 上,您可以通过执行以下操作来达到相同的效果:
1:取决于您拥有哪个版本(要找到它,请点击 Windows+R,键入“winver”,然后按 Enter):
手动输入缩放级别,即使它是下拉列表中可用的级别。如果系统提示您注销以使设置生效,您就会知道您已正确完成此操作。
2:将以下内容保存到桌面上的 .reg 文件中,然后双击它以将内容添加到您的注册表中:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide]
"PreferExternalManifest"=dword:00000001
Run Code Online (Sandbox Code Playgroud)
3:将以下文件另存为 c:\windows\system32\mmc.exe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
<assemblyIdentity
processorArchitecture="x86"
version="5.1.0.0"
name="Microsoft.Windows.MMC"
type="win32"
/>
<description>Microsoft Management Console</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="highestAvailable"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
Run Code Online (Sandbox Code Playgroud)
4:打开任何 MMC 窗口(服务、设备管理器等),它们现在会更大更清晰
归档时间: |
|
查看次数: |
15172 次 |
最近记录: |