Jump to content

Running "REG ADD" from within the registry


Tomcat76

Recommended Posts

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.

Link to comment
Share on other sites


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

 

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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