You are here

BAT files for installing/uninstalling REG files?

15 posts / 0 new
Last post
Anonymous (not verified)
BAT files for installing/uninstalling REG files?

What command can I put in a batch to import a registry key; and then for a 2nd batch, how would i remove that certain key

John T. Haller
John T. Haller's picture
Online
Last seen: 6 min 53 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Commands...

To Export:
REGEDIT /E filename.reg "Registry\Path"

To Merge:
REGEDIT filename.reg

The /S switch will merge silently (use with caution).

Example Backup:
REGEDIT /E httpbackup.reg "HKEY_CLASSES_ROOT\HTTP"

Example Restore:
REGEDIT /S httpbackup.reg

Sometimes, the impossible can become possible, if you're awesome!

Dan2552 (not verified)
OK. Thanks for that, now is

!!edit---
sorry, found the solution for deleting.
-----!!

OK. Thanks for that, now is there like a

REGEDIT /remove HKEY_CURRENT_USER\Software\Borland

which would delete the whole 'Borland' thing?

Torpedro
Offline
Last seen: 9 years 2 months ago
Joined: 2006-02-05 14:52
Deleting Registry keys with batch files

Hi!

This is my first post to the forum and i hope it's usefull.

To remove a key and all subkeys you would just put a minus in front of the key, so to remove putty's setting the regfile would be:
REGEDIT4
[-HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]

The big drawback is you have 2 .reg files, one for installing and one for uninstalling/deleting reg keys.

I use batchfiles for almost everything (with several tools), if threr are questions...

Torpedro

Dan2552 (not verified)
oh and almost forgot:

oh and almost forgot:
is there something i can put so the batch file finds the "home" directory of the person logged in on the computer, for example like

copy file.txt %homedir%

(where %homedir% could mean something like c:\docume~1\dan)

[- Home directory: The location of the home directory varies by platform.
Windows 95/98 (single-user): C:\Windows
Windows 95/98 (multi-user): C:\Windows\Profiles\
Windows NT: C:\WINNT\Profiles\
Windows 2000/XP: C:\Documents and Settings\
]

tittoproject
tittoproject's picture
Offline
Last seen: 3 years 11 months ago
Joined: 2005-12-09 12:23
Some tips

You can see the reg command help by typing:
reg /?
from a dos console. You can see the environment variables like %homedir% by typing:
set
from a dos console.

Dan2552 (not verified)
wow. Thanks!

wow. Thanks!

edit--
USERPROFILE would've worked great -- if windows put it in MS-DOS format Sad

atleast i got this working: (for XP and 2000 atleast :p)
copy blah.txt %HOMEDRIVE%\docume~1\%USERNAME%

Torpedro
Offline
Last seen: 9 years 2 months ago
Joined: 2006-02-05 14:52
use "%var%" for folders with spaces

Hi!

Why do you need dos format? Instead of
copy file.txt %homedir%
you could use
copy file.txt "%USERPROFILE%"

Torpedro

MrNerdHair
Offline
Last seen: 15 years 7 months ago
Joined: 2005-12-16 16:33
Now, Batch files are great

Now, Batch files are great and all, but they do muck up the registry for later users of the computer. I wrote a utility that will load reg entries and change them back to their original values after a program has run. If you want it, reply and I'll post it up.

Dan2552 (not verified)
i made two bats, one for

i made two bats, one for adding the stuff, one for removing. It runs fine and defiently gets rid of the added stuff Smile thanks anyway

Greavette
Offline
Last seen: 6 years 2 months ago
Joined: 2006-01-12 21:12
Utility to load reg entries and then clean up...

Hello MrNerdHair,

I wouldn't mind seeing this utility you wrote. Others might find it very useful too.

Thanks.

listaspablo
Offline
Last seen: 16 years 4 months ago
Joined: 2006-01-18 09:23
I want it

Please can you send me the program, so i try it? Thanks

pitter
Offline
Last seen: 16 years 2 months ago
Joined: 2006-01-31 01:42
I wouldn't mind

seeing that program, either. Could fix a couple problems...

nm35
Offline
Last seen: 16 years 2 months ago
Developer
Joined: 2005-12-12 17:13
Show me!

Send a copy to me! (You can e-mail it to me -- my e-mail is nm35.53mngmailcom.)

~nm35 {blog} {standalone apps}

Ashes for Tears
Offline
Last seen: 15 years 1 month ago
Joined: 2006-01-11 08:41
Ditto!

Ditto! Biggrin joy.desgmail.com

Topic locked