Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Apply a theme from command prompt ??

Apply a theme from command prompt ??

I'm trying to create a logon batch file that will enable us to apply a windows theme when users log on, the only problem is, when we run the *.theme file, we have to click OK or APPLY. Is there any way of running the *.theme file silently?  i've tried using a command prompt and using "start /b Lurky.theme" but it still opens the display properties window and waits for me to click OK or APPLY.

"Experience is the result of failure"

RE: Apply a theme from command prompt ??

I do not know how familiar you are with WSH scripting.  The Themes command line calls the associated file extension like this (I have fully pathed the command):

%windir%\system32\rundll32.exe %windir%\system32\Shell32.dll,Control_RunDLL %windir%\system32\desk.cpl  
desk,@Themes /Action:OpenTheme /File:"%1"

If there is a valid filename used for %1, it is substituted and highlighted waiting for an OK.

. You could use SENDKEY to answer the prompt
. You can use the excellent freeware AutoIt to roll the whole thing together in the alternative:

RE: Apply a theme from command prompt ??

I've never heard of WSH Scripting!

I tried to use sendkey, however, the sendkey command runs before the Display properties window has a chance to open. Also, it opens the Sendkey program as well as sending the OK command.

What we'd like is a completely silent way to apply a set theme on the pc's when a user logs on. The old Network Manager set policies that we can't get rid of, therefore when a user logs on, we get classic windows. We need something that runs on login and sets a new theme.

"Experience is the result of failure"

RE: Apply a theme from command prompt ??

WSH is the native XP installation of the "Windows Scripting Host."  This allows you to script in VB or Java as an alternative to .bat or .cmd files.  It has a native sendkey and RUN facility in either language.

You would run the first statement, and sendkey to the application to OK or Apply as needed.

Given the details I provided earlier, this is a simple script to enable and include at logon.  I apologize as I myself will likely not be able to look at this until late tonight, but if you check the forum again either myself or some of the scripting wizards will reply.  Or, post the question and the link back to here in Forum329

RE: Apply a theme from command prompt ??

Note to anyone attempting to script this:

add before the sendkey:

WSH.Sleep 1600  ' wait for desk.cpl to initialize

RE: Apply a theme from command prompt ??

On the same subject when I start the computer I get a choice of what operating system do I want to use Windows XP or Microsoft Windows if I don't respond it will start after 30 secs with Win XP, but it does wait for my response to press enter every time. I tried to edit Boot.ini in Sys Config Utility but it won't let me, is there anywhere else I can edit the sys boot? By the way I did a fresh install of winXP namely formatted the drive before installing XP.

RE: Apply a theme from command prompt ??

right-click My Computer, Properties, Advanced, Startup and recovery options - Settings, Edit.

Set in edit mode the default timout to 0.

RE: Apply a theme from command prompt ??

Re: Win XP boot, Yes it worked Thank You.

RE: Apply a theme from command prompt ??

' logon script to set the Theme
' make this the last logon entry
' make sure logon is processed syncrhonously through Group Policy **
' edit YOUR_THEME_HERE to a fully pathed theme

Const iFocus = 1

'open the Shell
Set objShell = Wscript.CreateObject("Wscript.Shell")

' now call Rundll32, and demand focus for the later Sendkeys
objShell = "rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"YOUR_THEME_HERE"", iFocus

'pause for the desk.cpl to initialize
Wscript.Sleep 1600

'send the confirmation to the control panel desk applet
objShell.Sendkeys "{ENTER}"

'  ... end of script

I have not tested this, but this is the gist of what you requested.

** XP by default processes logons asynchronously.  Change this though Group Policy.  See last paragraph of my FAQ779-4017 for instructions.

RE: Apply a theme from command prompt ??

When it comes to scripting, i'm clueless!!

I attempted to use Autoit and pasted the scipt into it, changed the theme for the path of the theme i use and it just came up with multiple errors when i ran it.

What exactly should i be doing with this script?

"Experience is the result of failure"

RE: Apply a theme from command prompt ??

I apologize, as this thread disappeared from my display.

AutoIT has it own scripting language.  What I wrote above I intended you to:

open a notepad session, and create something like themes.vbs, and copy paste the above

A .vbs or other script file should launch in a logon script, or use if part of a larger command session the syntax:

wscript themes.vbs

RE: Apply a theme from command prompt ??

Here's the code I wrote using AutoIT to restore the Windows Classic Theme to a workstation. After you compile, add START \\uncpath\Scriptname.exe to the last line of your logon script.

;AutoIT Script to Restore Windows Classic Theme to Users Desktop
;Created by GSpino12/17/2004
IF @OSVersion <> "WIN_XP" THEN
  MsgBox(0,"Error","You must be running Windows XP to run this utility")

Dim $var1 = '"' & @WindowsDir & '\'

;launch control panel applet to change desktop theme
Run(@ComSpec & " /c " & 'rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:' & $var1 & 'resources\themes\windows classic.theme"', "", @SW_HIDE)

;wait for Disply Properties window to open, timeout after 3 sec
WinWait("Display Properties", "",3)

;send Enter to open applet

;Exit application

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close