Change "Windows Font Size (DPI)" in Powershell?

I use a laptop in the office (Windows 7) with a station and a dual screen and at home without a station.
The fact is that I have to change the text size every time I switch from the station to a separate laptop, because the text size is too large on my dual screen, but too small on the laptop screen.

To continue:
I right-click on the table screen, select the shift resolution, then "get text and other elements more or less" to select 100%, 125%, etc.

I need to restart the session in order to apply the settings. (note: I use the French system, the texts are not quite the same in our version, I suppose).

This is not very convenient, so I would like to automate this, perhaps with a powershell script.
Ideally, the script might detect that I am using only a laptop or a dual-screen station). Also, without restarting the session (I doubt this last point is possible).

Does anyone have any ideas for me to get started? If possible.

+7
source share
3 answers

As expected in other answers, setting up under HKLM is not the right place, since dpi scaling is a user setting. The correct HKCU:\Control Panel\Desktop registry HKCU:\Control Panel\Desktop with a value of LogPixels .

Additional information on all DPI-related registry settings can be found here: http://technet.microsoft.com/en-us/library/dn528846.aspx#system

I wrote a tiny PowerShell script that changes DPI scaling depending on the current zoom and shuts down the user, so I just need to execute the script when I put my device on another monitor.

 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 
+6
source

Apparently you can set the LogPixels property

 HKLM:/Software/Microsoft/Windows NT/CurrentVersion/FontDPI 

which is repeated in many places around the network. However, I got the impression that dpi is a custom setting that does not make sense to have under HKLM.

+3
source

Sorry, I misunderstood the question. I thought you want to manage PowerShell windows.

As already mentioned, you can set the LogPixels parameter in the registry to find out what the current setting is, try the following:

 Get-Item -Path Registry::'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI' | Select-Object -ExpandProperty Property 

If the LogPixels key appears, you can create it if it does not exist:

 Set-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI\LogPixels' 

Note. You must run this with privileges that allow you to manage the registry.

Technet has a good introduction .

+1
source

All Articles