AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 570785
Accepted
user20939
user20939
Asked: 2014-01-30 08:27:24 +0800 CST2014-01-30 08:27:24 +0800 CST 2014-01-30 08:27:24 +0800 CST

如何在 Windows 8.1 中使 Microsoft 管理控制台具有高 DPI 感知能力?

  • 772

由于 Windows 8.1 不允许系统范围内的“Windows XP 风格”高 DPI 支持,如何让 Microsoft 管理控制台应用程序 (mmc.exe) 支持高 DPI?它没有“疑难解答兼容性”上下文菜单项。

scaling
  • 2 2 个回答
  • 16030 Views

2 个回答

  • Voted
  1. Best Answer
    Rod Boev
    2014-02-20T01:56:24+08:002014-02-20T01:56:24+08:00

    系统文件的兼容性选项卡是隐藏的,因此要复制“禁用高 DPI 设置时的显示缩放”复选框的功能,您需要将以下内容添加到注册表中:

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
    "C:\\Windows\\System32\\mmc.exe"="~ HIGHDPIAWARE"
    

    这还有一个额外的好处,就是使所有 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"
    

    由于“以管理员身份运行”和“禁用 DPI 缩放”设置存储在一起,因此在已设置为以管理员身份运行的文件上调用该命令将清除该标志并改为设置 DPI 缩放标志。这只会影响您手动选中该框的文件,而不是那些在其清单中具有正确请求执行级别的文件。

    仅供参考,当两者都被选中时,字符串是“~ 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\""
    

    在像 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\""
    

    如果 nircmd.exe 不在您的路径中,您可以将其位置添加到上方或将其文件夹添加到系统环境变量对话框中的路径中。要打开该窗口,您可以使用命令rundll32 sysdm.cpl,EditEnvironmentVariables

    reg import /s可以说,通过在运行时创建 .reg 文件并使用未记录的选项静默导入它来添加注册表项会更优雅。但根据我的经验,在运行时编写任何文件都会引发各种安全产品的警报,例如 COMODO Internet Securita、Panda、Norton 等的等效版本以及任何基于 HIPS 模型的产品。当上述工作正常时,我认为没有必要这样做,特别是如果您在多台计算机上使用它或共享它并且不想为其他人制造误报。

    但是,如果您已经在使用 nircmd,那么使用它的regsetval命令而不是reg add.exe 和 .msi shell 扩展名是有意义的。文件夹选项仍然需要遍历目录列表以添加每个条目,因此它不适用于这些条目。PowerShell 和 VBScript 是选项,但它们的可用性取决于 Windows 的版本和许多其他变量。从安全的角度来看,VBScript 作为攻击媒介享有盛誉,特别是当从 Internet 下载或在网络上共享时,如果没有明确设置 PowerShell 的执行策略以允许远程签名脚本,PS1 脚本将根本无法运行。

    如果您在使用该代码时发现任何奇怪之处,请告诉我,因为它仍在进行中。话虽如此,它应该使配置 Windows 8.1 的 DPI 设置更加容易。

    • 25
  2. Rod Boev
    2017-03-19T08:17:06+08:002017-03-19T08:17:06+08:00

    在 Windows 10 上,您可以通过执行以下操作来实现相同的效果:

    1:根据您拥有的版本(要找到它,点击 Windows+R,输入“winver”,按 Enter):

    • build 15019 之前:打开控制面板、显示、更改项目大小、设置自定义缩放级别
    • build 15019 或更高版本:打开设置、系统、显示、自定义缩放

    手动输入缩放级别,即使它是下拉菜单中可用的级别。如果系统提示您退出以使设置生效,您将知道您已正确完成。

    2:将以下内容保存到桌面上的 .reg 文件中,然后双击它以将内容添加到您的注册表中:

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide]
    "PreferExternalManifest"=dword:00000001
    

    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>
    

    4:打开任何MMC窗口(服务、设备管理器等),它们现在会更大更清晰

    • 6

相关问题

  • 我应该怎么做才能横向扩展 Sql2008 数据库?

  • 什么限制了 Linux 服务器上的最大连接数?

  • 我的网络服务器应该能够处理多少个请求?

  • 多个 Web 服务器共享一个数据库服务器

  • 哪个数据库服务器扩展性更好:PostgreSQL 还是 MySQL?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve