Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 15th, 2005, 11:18 AM   #1
dpasswat
Newbie
 
Join Date: Mar 2005
Location: Huntsville, AL
Posts: 2
Rep Power: 0 dpasswat is on a distinguished road
Update registry key value via batch file

I've written a screen saver, and I'm trying to make it the current screen with a batch file. I can do all of the file stuff, but I'm having trouble updating the registry. BTW: I am in admin mode. My code so far:

cls

del MBScrnSvr.scr
ren MBScrnSvr.exe MBScrnSvr.scr

IF NOT EXIST c:\Windows\system32\MBScrnSvr.scr GOTO INSTALL_SCRNSVR_END

del c:\Windows\system32\MBScrnSvr.scr
:INSTALL_SCRNSVR_END

copy MBScrnSvr.scr c:\Windows\system32\

rem  key:         HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE
rem  Key value: C:\WINDOWS\System32\MBSCRN~1.SCR

HKEY_CURRENT_USER\Control Panel\Desktop "SCRNSAVE.EXE" = -

HKEY_CURRENT_USER\Control Panel\Desktop "SCRNSAVE.EXE" = -s C:\WINDOWS\System32\MBSCRN~1.SCR

Thanks.
dpasswat is offline   Reply With Quote
Old Mar 17th, 2005, 10:45 AM   #2
dpasswat
Newbie
 
Join Date: Mar 2005
Location: Huntsville, AL
Posts: 2
Rep Power: 0 dpasswat is on a distinguished road
Yes there is a way to update the registry from a batch file. However, it will require a second file (import.reg). The batch file code will look something like this:

cls

REGEDIT.EXE /S C:\Import.reg

cls

The import file will be created by exporting the hive containing the key to be changed. Remove all text with the exception of the registry editor title line, the path, and key with key value to be updated.
Ex:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
"SCRNSAVE.EXE"="C:\\WINDOWS\\System32\\MBSCRN~1.SCR"
dpasswat is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:05 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC