Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
Tomcat76

Running "REG ADD" from within the registry

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

 

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...