C# – Running an executable in compatibility mode through CMD

cwindows-8.1

What lines of code could be used in either CMD or .bat form to run an executable file in compatibility mode?
Can it be done at all, or is it some registry wizardry?

Best Answer

First of all, you need to be Administrator or be in group of them. Second, you need to know what kind of compatibility you are going to set (Windows 7, Windows XP, etc...) Third, only applied for .exe files

I've set compatibility for Windows XP S3 for my .exe file Open cmd line as Administrator.

Some example:

Windows 7         - ~ WIN7RTM
Windows XP SP3    - ~ WINXPSP3
Windows Vista SP1 - ~ VISTASP1

Note: This will be applied for all users

reg.exe Add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Users\****\Desktop\MPC-HC.1.7.10.x64.exe" /d "WINXPSP3"

For current user only

reg.exe Add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Users\****\Desktop\MPC-HC.1.7.10.x64.exe" /d "WINXPSP3"

I've got: Flag