Link to home
Start Free TrialLog in
Avatar of Eddie Shipman
Eddie ShipmanFlag for United States of America

asked on

Setting Theme via shell script on Windows 10

I have a shell script that I've been using for Windows 7. It sets the theme for my system desktop. It no longer works now that I've moved to Windows 10.
With WScript.CreateObject("WScript.Shell")
    WScript.echo "Open Theme dialog and select theme and then close"

    .Run "rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:""%UserProfile%\AppData\Local\Microsoft\Windows\Themes\MyPersonal.theme"""
    For i = 1 To 10
            WScript.Sleep 5000
        If .AppActivate("Personalization") Then
           .Sendkeys "%FC"
           .Sendkeys "{F4}"
           Exit For
        End If
    Next
End With

Open in new window

I know I can open the Themes dialog using the run command and
ms-settings:themes

Open in new window

But how would I this as well as select the theme and close the dialog in a shell script on Windows 10?
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

ASKER

That is Powershell. I'm running VBScript,
This command works for me

"%UserProfile%\AppData\Local\Microsoft\Windows\Themes\MyPersonal.theme" & timeout /t 5 & taskkill /F /IM systemsettings.exe

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial