reg command line utility

K

kakii

Win XP Pro SP3

Two swap files: one on a special swap-file drive,
another one on the system disk C:\.
The second one only for purposes of memory dumps in crash situations.
For purposes of disk backup process the second one (placed on C:\)
should be temporary disabled.

For this purpose appropriate registry value is planned to be manipulated
by the backup script:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management\PagingFiles

I don't want to manipulate the whole key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management
because I don't know if during the whole back-up process
some other values from this key are being changed as well.

However, the reg utility's commands SAVE and RESTORE
can handle registry keys only.
How can I backup and restore the key value selectively ?
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management\PagingFiles
 
J

John Wunderlich

Win XP Pro SP3

Two swap files: one on a special swap-file drive,
another one on the system disk C:\.
The second one only for purposes of memory dumps in crash
situations. For purposes of disk backup process the second one
(placed on C:\) should be temporary disabled.

For this purpose appropriate registry value is planned to be
manipulated by the backup script:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management\PagingFiles

I don't want to manipulate the whole key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management
because I don't know if during the whole back-up process
some other values from this key are being changed as well.

However, the reg utility's commands SAVE and RESTORE
can handle registry keys only.
How can I backup and restore the key value selectively ?
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Memory Management\PagingFiles

Instead of using "reg save", try using "reg export".
This will still export the entire key, but it is in a Ascii /
Editable format so that you can right-click on the resulting .reg
file, select "Edit", and edit out all values/keys that you are not
interested in saving -- keeping the one(s) that you want. Simply
double-clicking on the resulting file will then restore just that one
value (or use "reg import" if you want).

HTH,
John
 
J

John John (MVP)

You can use REG COPY to save a value to another dummy key and location
*inside* the registry then you can then use REG SAVE to save the copied
dummy key to a file on the disk. I take it that you understand the
registry and that you are familiar working with registry data, all of
the examples below are safe to try but you need to know what you are
doing to work with these commands, you may want to take a restore point
or back up your registry before you play with these commands and
examples, if it blows up in your face it's not my fault!

To see the above in semi real time open Regedit and Alt+Tab your way
between Regedit and the Command Prompt. After you run commands, and
while you are in Regedit, press F5 to refresh the registry, it takes a
few seconds and you may have to hit F5 more than once to see the
changes, data is only written to the Registry when a flush occurs, which
happens after changed data ages past a few seconds, or when an
application intentionally flushes the data to the hard disk. In Regedit
go to the HKCU root key, that is a safe place to send our test to.

To copy the PagingFiles value:

REG COPY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
Management\PagingFiles" HKCU\Test\PagingFiles

Now refresh the registry and look for HKCU\Test\PagingFiles.

You can now use the REG SAVE command to save the HKCU\Test\ key. To
restore the value just do the opposite:

REG COPY HKCU\Test\PagingFiles
"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
Management\PagingFiles"

Probably a bit of a kludge but an easy workaround nonetheless.

Now, I have to ask, why do you need to do this? If it isn't already
excluded why not simply exclude the paging file from the backup set?

John
 
K

kakii

Thanks for your hint.
However, the backup process should be completely automatic.
Therefore I don't think I can apply this.
 
K

kakii

Thanks for your hint.
Your proposal looks well.
I will try it.

My disk image application (Acronis True Image 9.0 Home) doesn't
support file filtering files for disk images. And the backup of
my system disk will be made as disk image.
I think ATI 10 or 11 can filter files for disk images.
But I don't plan an upgrade yet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top