Jump to content


[Trick] How to Set Windows theme from command line

  • Please log in to reply
2 replies to this topic

#1 Ken@fri


    WinCert Friend

  • Members
  • PipPipPipPip
  • 246 posts
  • Location:Libreville
  • OS:Windows 7

Posted 16 January 2010 - 04:28 PM

For a theme addon, based on moataz Royal AIO theme, I was looking for how to select a particular theme from the command line or script with no user interaction.

The following command works rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"%windir%\\resources\\themes\\Royal AIO.theme, but it shows a confirmation box with button. I want to run this SILENTLY with the assumed answer "yes".

After googling during a week, I finally found how to do it >>>HERE<<<
Posted Image

Little mods in the script to set theme dir dynamically & increase time sleep,
objShell.Run('rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"%windir%\\resources\\themes\\%YOUR_THEME_NAME%.theme"',1);


AND.... :

// FILE: theme.js
// DESCRIPTION: automatically set the Windows theme

// create shell object

objShell = new ActiveXObject("WScript.Shell");

// start themes applet, load desired theme, and activate this window
objShell.Run('rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"%windir%\\resources\\themes\\Royal AIO.theme"',1);

// wait for themes window

// send the 'enter' key to accept this theme

To use it, just create a new .txt file, copy-past script above & save as .js file (like theme.js)

This is how I apply it in my INF file :


11,,rundll32.exe,,,"advpack.dll,LaunchINFSection ""%01%\RoyalTem.inf"",Install"

BeginPrompt = ...
RunPreSetupCommands = Create.i386:1
CopyFiles = ...
AddReg = ...
UpdateInis = ...
RunPostSetupCommands= SetRoyalistTheme.AsDefaultTheme
EndPrompt = ...

RUNDLL32 advpack.dll,LaunchINFSection ""%01%\RoyalTem.inf"",Default.Theme.Choice"

BeginPrompt = RoyalistThemeChoicePrompt
RunPostSetupCommands = Default_Theme_Choicer
EndPrompt = EndInsThemePrompt

; At the end of copy files, u can set Royal AIO as Windows default theme
Title ="::. %ThemeChoice_Title% .::"
Prompt ="%ThemeReplacerPrompt%"

Posted Image

; If u're response's YES, file theme.js will be run & Royal AIO installed as default theme (visual style is Royal)
; If NO, your current theme will be kept

"WSCRIPT ""%01%\theme.js"""

Enjoy !

Edited by Ken@fri, 03 February 2010 - 03:21 PM.

#2 Geej


    Wincert Addict

  • Ultimate Sponsor
  • 625 posts
  • OS:Windows XP Pro

Posted 01 February 2010 - 07:03 AM

Thanks for the trick. It has inspire me to make an addon. :D

#3 Ken@fri


    WinCert Friend

  • Members
  • PipPipPipPip
  • 246 posts
  • Location:Libreville
  • OS:Windows 7

Posted 03 February 2010 - 03:20 PM

Hi Geej!

Thanx 4 your contribution. I've downloaded your soft few minutes ago.

Bye :welcome: .

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users