How do I change the current Windows theme programmatically?

前端 未结 12 1984
轻奢々
轻奢々 2020-12-04 11:12

I want to allow my users to toggle the current user theme between Aero and Windows Classic(1). Is there a way that I can do this programatically?

I don\'t want to po

12条回答
  •  悲哀的现实
    2020-12-04 12:09

    The command for newer Windows versions (Windows 8 and 8.1, haven't tried it on W10 yet) is:

    rundll32.exe themecpl.dll,OpenThemeAction %1
    

    or with full paths:

    C:\WINDOWS\system32\rundll32.exe C:\WINDOWS\system32\themecpl.dll,OpenThemeAction %LocalAppData%\Microsoft\Windows\Themes\yourtheme.theme
    

    Basically it's the Personalisation CPL "open" command for .theme & .themepack extensions taken from registry...

    You'll still end up with the Personalisation window beeing open after using this command so to close it down programatically you'll have to use one of the suggested methods mentioned above... (I personally prefer the Powershell script)

提交回复
热议问题