XP batch file scripting / registry question

G

Guest

Hopefully this is an easy question. All machines are running XP Pro SP2

I have a script that everyone in the office runs daily; it makes sure all
network drives are mapped correctly and updates any registry settings via the
regedit /s command.

My issue is this, though - some registry changes in HKCU don't take effect
right away, like desktop settings. (We have only one authorized desktop image
that people like to change.) So then when someone logs out and Windows does
the "Saving Your Settings" thing, I think it over-writes the changes the
regedit /s made.

Is there something I can put in the script to implement all changes to HKCU
immediately? Thanks very much in advance.

Warm regards,

Jim
 
D

Doug Knox MS-MVP

You're correct. Some settings are only saved at log off. Manaul changes made to the registry will be overwritten. The only way around this is to kill the EXPLORER.EXE process and restart it, after you've made the registry changes.
 
G

Guest

That's what I was thinking but I wasn't sure. Do you know of a command to
kill a certain process from within a .bat? Thanks!

Jim
 
D

Doug Knox MS-MVP

Hi Jim,

TASKKILL will kill running processes, but the user who's account the BAT file is running under needs to have the appropriate permissions to kill a process. TASKKILL /? in a command prompt window will give you the required command line options.
 
G

Guest

Awesome. Last question (I think):

So I have the lines
-------------------------------------
TASKKILL /F /IM EXPLORER.EXE
EXPLORER.EXE
-------------------------------------
in the .bat; but the script hangs after explorer restarts. I can move the
kill / restart to the end of the script, but the cmd box that opens when the
script runs won't go away, know what I mean?

Any ideas you might have would of course be appreciated.

Thanks again!

Jim
 
D

Doug Knox MS-MVP

You should just be able to add an EXIT command at the end. You may also want to look into the START command.

TASKKILL /F /IM EXPLORER.EXE
START EXPLORER.EXE

or

TASKKILL /F /IM EXPLORER.EXE
EXPLORER.EXE
EXIT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top