# Registry Restore using batch



## marcus.chua (Feb 5, 2009)

I need some assistance to write a batch program to be put into Windows startup to restore the value in the SharePath value. Currently, I've done a backup registry copy and do it manual each time the SharePath value went missing.

[HKEY_LOCAL_MACHINE\SOFTWARE\Lucent\BCMS Vu\R2\Server\ServerDetails]
"SharePath"="C:\\Program Files\\Avaya\\BCMS Vu\\Server"


----------



## Rollin_Again (Sep 4, 2003)

Can't you just export the correct registry key value to a *.reg* file and then put the *.reg* file in the startup folder?

Regards,
Rollin


----------



## TheOutcaste (Aug 8, 2007)

Welcome to TSG!

You can put the *.reg file in the Startup folder. You'll be prompted to OK the merge, then will need to OK the success message.

If you want it done silently:
Put the .reg file into a folder that all users have permission to read
Create a shortcut to the file (right click, click *Create Shortcut*)
Right click the shortcut and click *Properties*
On the *Shortcut* tab click once in the *Target:* box, then press *Home*
Type the following in front of the path to the .reg file. Be sure to leave a space after the */s*
*%SystemRoot%\regedit.exe /s*
So for example, it will look like this:
*%SystemRoot%\regedit.exe /s "C:\Regfix\sharepath.reg"
*Set the *Run:* box to *Minimized*
Add a comment if you want
Click *OK*

Now move the shortcut to the All Users Startup folder, found here on XP:
* C:\Documents and Settings\All Users\Start Menu\Programs\Startup*

This will then merge the file whenever anyone logs in.
Users must have the ability to run regedit though.

If that's not the case, you can put the line from the Target box (*%SystemRoot%\regedit.exe /s "C:\Regfix\sharepath.reg"*) into a batch file, and create a Scheduled Task to run when the computer starts. This will let you specify an Admin account for it to run under.

HTH

Jerry


----------



## Rollin_Again (Sep 4, 2003)

You also have the option of using a VBS script to do this but I think you should be able to get by with the solutions that have been provided above.

Regards,
Rollin


----------

