[Trick] How to Set Windows theme from command line

Questions about Update Pack making? Ask here.
Post Reply
Posts: 95
Joined: Mon Jul 27, 2009 9:44 am
Location: Libreville (GABON)

[Trick] How to Set Windows theme from command line

Post by Ken@fri » Sat Jan 16, 2010 12:40 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<<<

Little mods in the script to set theme dir dynamically & increase time sleep,

Code: Select all

objShell.Run('rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"%windir%\\resources\\themes\\%YOUR_THEME_NAME%.theme"',[color=#FF0000]1[/color]);


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%"


; 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 !
Last edited by Ken@fri on Mon Jan 18, 2010 5:32 am, edited 5 times in total.

User avatar
Site Admin
Posts: 4621
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Sat Jan 16, 2010 2:17 pm

Thanks, Ken@fri. :)

I do something similar with an AutoIt script for my themes smart installer. Unfortunately, I lost the source code back in July. :(

Posts: 95
Joined: Mon Jul 27, 2009 9:44 am
Location: Libreville (GABON)

Post by Ken@fri » Sun Jan 17, 2010 10:50 am

U're welcome, 5eraph :D

All credit go to the author of script.

bye !

Posts: 95
Joined: Mon Jul 27, 2009 9:44 am
Location: Libreville (GABON)

Post by Ken@fri » Mon Jan 18, 2010 5:56 am

Hi 5eraph

I'm also looking for a script (JavaScript, autoIt script...) to reach User Account Pictures (UAP) choosing screen

Unfortunately, this commands rundll32 shell32.dll,Control_RunDLL nusrmgr.cpl" | "mshta.exe "res://%11%\nusrmgr.cpl/nusrmgr.hta" don't do the job.

Any idea?

Post Reply