derwowusste
Goto Top

Suche Skript, um die DPI in Windows 7 oder 8 anzupassen

Ich grüße alle Admins!

Hat jemand hier ein Skript oder Kommandozeilentool auf Lager, welches die System-Schriftgröße unter Windows anpasst?

Content-ID: 271102

Url: https://administrator.de/forum/suche-skript-um-die-dpi-in-windows-7-oder-8-anzupassen-271102.html

Ausgedruckt am: 14.04.2025 um 14:04 Uhr

Dani
Dani 05.05.2015 um 11:22:23 Uhr
Goto Top
Moin,
du könntest per Skript den Wert ändern:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI


Gruß,
Dani
AnkhMorpork
AnkhMorpork 05.05.2015 um 11:45:23 Uhr
Goto Top
Hi,

habe das hier, aber bei mir hadert es etwas:

1
2
3
4
5
6
7
8
9
10
11
cd 'HKCU:\Control Panel\Desktop'  
$val = Get-ItemProperty -Path . -Name "LogPixels"  
if($val.LogPixels -ne 96)
{
    Write-Host 'Change to 100% / 96 dpi'  
    Set-ItemProperty -Path . -Name LogPixels -Value 96
} else {
    Write-Host 'Change to 150% / 144 dpi'  
    Set-ItemProperty -Path . -Name LogPixels -Value 144
}
logoff;exit

Quelle: https://stackoverflow.com/questions/10365394/change-windows-font-size-dp ...


Gruß

Ankh
DerWoWusste
DerWoWusste 05.05.2015 aktualisiert um 14:30:05 Uhr
Goto Top
Hi.

@Dani: seit Win7 ist das pro-User und nicht mehr Pro Maschine, also nicht mehr in HKLM.
@AnkhMorpork: Danke, ich habe hier fast ausschließlich win8.1, deshalb wird noch mehr benötigt.
Sieht nach diesen Regkeys aus:
1
2
3
4
5
6
7
8
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
"Win8DpiScaling"=dword:00000001  
"DesktopDPIOverride"="1"  
"LogPixels"=dword:00000078  
[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"UseDpiScaling"=dword:0x00000000  

Ich sag später noch mehr dazu.
colinardo
colinardo 06.05.2015 aktualisiert um 17:55:59 Uhr
Goto Top
Also das Script funktioniert hier unter Windows 7 und 8(.1) ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function set-dpi([int]$dpi){
    $key = 'HKCU:\Control Panel\Desktop'  
    $version = [System.Environment]::OSVersion.Version.Minor
    switch ($version){
        1 {
            # Windows 7
            if ($dpi -eq 96 ){
                Set-ItemProperty $key -Name "LogPixels" -Value 96  
            }else{
                Set-ItemProperty $key -Name "LogPixels" -Value $dpi  
            }
        }
        {$_ -match '2|3'}{  
            # Windows 8(.1)
            if ($dpi -eq 96 ){
                Set-ItemProperty $key -Name "LogPixels" -Value 96  
                Set-ItemProperty $key -Name "Win8DpiScaling" -Value 0  
            }else{
                Set-ItemProperty $key -Name "LogPixels" -Value $dpi  
                Set-ItemProperty $key -Name "Win8DpiScaling" -Value 1  
            }
        }
    }
    logoff
}

# reset to dpi to 100%
# set-dpi 96

# set dpi to specific value
set-dpi 120
Grüße Uwe