Jump to content

Running "REG ADD" from within the registry


Recommended Posts

Posted

The Windows 7 PCs here regularly lose their screensaver after a reboot.  The name/value with the screensaver name is missing from the registry when that happens, so I want that name/value to be re-added upon every system boot.  I can put a REG ADD command in a CMD file and have it run from HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, but I was wondering if it's possible to avoid the CMD file and have the REG ADD command directly in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
 
I can't seem to find anything on this online.


Posted

There's no issue adding it directly, eg.:

reg.exe ADD "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /d "whatever.scr"

Putting this as the run entry works fine.

Posted

Regedit (besides reg.exe) allows to merge a .reg file, i.e.

REGEDIT [ /S ] addsome.REG

Is that what you are asking? :unsure:

You can also have (alternatively) a ,cmd that embeds the .reg, see:

https://www.robvanderwoude.com/regedit.php

Conversely, if the .reg file extension is associated to regedit, "executing" the .reg file will merge its contents to Registry, but - since you don't have the /S parameter you will need to click on the confirmation popup.

If the issue is with not showing the flashing CMD window when using a batch, you can use nircmd or any other among the various dediated toolsm or possibly also a .lnk file to run minimized.

jaclaz

 

Posted

@UCyborg
Yup, it's working fine.  This is what the exported .reg file looks like for the Ribbons screensaver (handy as a one-time activation on other PCs):
 

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"ForceScreenSaver"="REG ADD \"HKCU\\Control Panel\\Desktop\" /f /v \"SCRNSAVE.EXE\" /t REG_SZ /d \"C:\\Windows\\system32\\Ribbons.scr\""

 
@jaclaz
I wanted to avoid referencing an external file (.reg, .cmd, etc) in the Run command to keep it as simple as possible.

Posted
13 hours ago, Tomcat76 said:

@jaclaz
I wanted to avoid referencing an external file (.reg, .cmd, etc) in the Run command to keep it as simple as possible.

Yep :), as often happen it depends on point of view, on what is "simple". 

I personally find it simpler to have a small .cmd/.bat like the self-contained batch, de gustibus ....

jaclaz

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...