1
votes

The following code is used to change my Windows theme:

Set WshShell = WScript.CreateObject("WScript.Shell")

sLocalAppDataPath = WshShell.ExpandEnvironmentStrings("%localappdata%")

WshShell.Exec "rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:""" & sLocalAppDataPath & "\Microsoft\Windows\Themes\Custom.theme"""

After it is finished running, the Peronalization window stays open. Is it possible to run a file without even opening the window to begin with? I know how to close it using sendkeys, but I don't want to do this. Any help is much appreciated!

1
stackoverflow.com/questions/24740285/… It tries to show that you cant wait for rundll32.exe to finish processing with InitWindowStyle. The OP used a Sleep with SendKeys. @Sorceri is what you were trying to lead OP to? - Matt

1 Answers

0
votes

Can't be done without sending keystrokes or using autoit or something like that. Take a look at http://winaero.com/blog/how-to-change-a-windows-theme-from-the-command-prompt/ Haven't tried ik but looks promissing. Keep us informed.

Succes !