Document Contents
Run a command using the value in a registry entry
Get the data type and value into environment variables
DTREG.EXE
Version 1.0s
Copyright 1994-2001 by David G. Thomas
Last changed May, 1998
To obtain the latest version, visit http://www.tamedos.com/downloads
Note: This application was renamed from REG to DtReg so that it will not conflict with the Microsoft program that is also called Reg.exe.
DTREG provides an efficient way to apply batch updates to the Windows NT registry. It also allows querying the registry.
This program may be freely distributed as long as this document file is distributed with it and no money is charged. If Tame is included with a suite of utilities then the distributor may charge a small distribution fee, but no additional fee may be charged for inclusion of REG.
This program is provided free of charge by the author of Tame(r). Tame improves performance when running DOS applications in a multi-tasking system such as Windows NT and Windows 95.
DTREG.EXE is Copyright 1994-2001 by David G. Thomas. Questions or comments may be addressed to mailto:reg@tamedos.com.
This is a plain-language version of the standard disclaimer. This program is provided as-is. I tried to make it useful, functional and bug free, but in reality, the program is not guaranteed to do anything, and if it does something undesirable then the author is not liable. Use it at your own risk.
DtReg
{options}
All options may be abbreviated. The abbreviated form is indicated with upper case letters.
Options will be read from the specified file name. Lines beginning with a semi-colon (;) will be treated as a comment and ignored. This is the same as using the –InputFile option with option_file as the path.
Add the specified key to the registry.
Check if the key is in the registry, and set the ERRORLEVEL to 1 if it does not exist.
Specify the computer that all registry operations will occur on.
Remove the named registry value.
Remove the named registry key. Note that the key must be empty before deleting it.
Remove the named registry key and all sub-keys that are contained in it
Scan the batch file dor PATH and SET statements, and load the Windows NT user environment with the values that are found. This may be used in order to permanently load the AUTOEXEC.BAT into the Windows NT environment.
Note that the COMSPEC environment value is always ignored. This is because COMSPEC can cause lots of grief if it is set to the DOS version of COMMAND.COM.
Add the directory to the end of the user path. If it already is in the path, it will remain unchanged.
Note that this command will not affect any currently open windows. When a new window is launched from Program Manager, it will reflect the modified value.
Remove the directory from the user path.
Note that this command will not affect any currently open windows. When a new window is launched from Program Manager, it will reflect the modified value.
Set the specified user environment value.
Note that this command will not affect any currently open windows. When a new window is launched from Program Manager, it will reflect the modified value.
Load options from the specified file. This is the same as @filename.
Expand environment values that are specified in an option file. Environment value names should be enclosed in ‘%’ marks, as is done with normal batch files. The buffer size is an optional argument that sets the maximum length of an expanded string. The default is 2000 characters if no buffer size is specified. If a buffer size of 0 is specified then this disables expansion of values. The default is to not expand values.
List the specified registry value in the form ‘Name’ = Type ‘Value’.
List the specified registry value without the name and without quoting the value. This form of output is more suitable to piping into the Windows NT for command to extract the type and/or value into environment values (See examples below).
Scan the batch file for PATH and SET statements, and load the Windows NT machine environment with the values that are found. This may be used in order to permanently load the AUTOEXEC.BAT into the Windows NT environment.
Note that the COMSPEC environment value is always ignored. This is because COMSPEC can cause lots of grief if it is set to the DOS version of COMMAND.COM.
Note also that this command will not affect any currently open windows. When a new window is launched from Program Manager, it will reflect the modified value.
Add the directory to the end of the machine path. If it already is in the path, it will remain unchanged.
Note that this command will not affect any currently open windows. When a new window is launched, it will reflect the modified value.
Remove the directory from the machine path.
Note that this command will not affect any currently open windows. When a new window is launched, it will reflect the modified value.
Set the specified machine environment value.
Note that this command will not affect any currently open windows. When a new window is launched, it will reflect the modified value.
Display the current user and machine path as specified in the registry.
Produce no messages unless an error occurs.
Set the value based on keyboard response from the user. This is a very primitive interface, but it does work...
Load the key values and sub-keys that were previously saved using –SaveKey.
Save the key values and sub-keys that they may later be loaded into the registry using –RestoreKey.
Set the specified registry variable to the specified value. The following types of values are accepted:
REG_DWORD Integer value that may be in decimal, or hex by specifying 0x as a prefix.
REG_SZ Simple string value
REG_EXPAND_SZ A value that contains %environment% references that may be expanded
REG_MULTI_SZ A multi-line string where the first character of the value is a line delimiter.
Set the delimiter that separates the registry key name from the value name. This may be used when the name of a value must contain a backslash. Note that key names may not contain a backslash, but it is allowed with value names.
Notes:
1. If the path (or any other argument) contains spaces, it should be enclosed in quotes (“)
2. If a value name is blank, enclose the path name in quotes and specify a trailing blank (e.g. “\path\ “)
\root\item\name |
Absolute registry path name where the root may be User, Users or Machine. User refers to HKEY_CURRENT_USER, Users refers to HKEY_USERS and Machine refers to HKEY_LOCAL_MACHINE, This may also be the 4 letter common acronym for the root key name. HKCU, HKU, HKLM, HKCR, HKCC or HKDD are currently accepted values. |
\path\ |
A trailing back slash sets the default key that subsequent names are in |
Key\name |
A specification relative to the default key |
\\machine\root\name |
Registry path may be specified on a different machine |
The following root names are valid.
HKCC |
HKEY_CURRENT_CONFIG |
HKCR |
HKEY_CLASSES_ROOT |
HKCU |
HKEY_CURRENT_USER |
HKDD |
HKEY_DYN_DATA |
HKU |
HKEY_USERS |
HKLM |
HKEY_LOCAL_MACHINE |
Load options that are listed in file SETUSER.RI.
Add the key
Set the value of \User\Software\Test\Value to a REG_SZ value of “Test Value”
This will set two values that are of type REG_DWORD and are in the \User\Software\Test key.
This will set a registry value on a remote machine.
This will set the default registry value for the Test key. Note the space after the last backslash in the path specification.
This will set a value named “C:\TEST.LOG”
The following batch file uses the extended syntax of the “for” command to extract the value and use it in the batch file. It has been tested with Windows NT version 4.0.
@echo off
rem This batch file will list the directory of the
Windows NT source CD
set rp="\machine\software\Microsoft\Windows NT\CurrentVersion\SourcePath"
for /f "tokens=1*" %%i in ('reg -lv %rp%') do
dir %%j
The following batch file uses the extended syntax of the for command to extract the data type and value into environment values that may be used in the batch file. It has been tested with Windows NT version 4.0.
@echo off
rem This
batch file will list the directory of the Windows NT source CD
set rp="\machine\software\Microsoft\Windows
NT\CurrentVersion\SourcePath"
for /f "tokens=1*" %%i in
('reg -lv %rp%') do set RegValueType=%%i&set RegValue=%%j
if %RegValueType%
== Undefined goto error
echo dir %RegValue%
dir %RegValue%
goto done
:error
echo **** %RegValueType%
%RegValue%
:done
set rp=
set RegValue=
set RegValueType=