Set DPI Programmatically in Windows
Setting DPI Scaling
Via command line:
This one seems relatively promising.
Via Windows system API:
SystemParametersInfoW function (winuser.h) - Win32 apps
See SPI_GETLOGICALDPIOVERRIDE - 0x009E.
It seems like the parameter for scaling is an integer, where 0 is the “recommended” setting you’d see in the Windows settings panel. A value of ±X will change the scaling by (X * 25%) in either direction from the recommended value, ergo there might be an issue of having to figure out what the recommended scale factor is and adjust based on that.
This API is discouraged by Microsoft.
Via PowerShell:
Force 100% DPI Scaling for all screens even if the default value is different
Example API calls & demo apps:
How can I change Windows 10 Display Scaling Programmatically using C#