\\ Amazon冬支度セール 2024年11月4日 (水) ~ 11月12日 (火) 23:59 //

How to Use the reg and regini Commands | Windows Registry Management

The reg and regini commands are essential tools for managing Windows registry settings via the command line. Whether you need to add or delete registry keys, query settings, or apply configurations across multiple systems, these commands offer flexibility and power.

目次

What is the reg Command?

The reg command is a command-line tool for managing the Windows registry. It allows you to add, delete, query, export, and import registry keys and values on both local and remote computers. The reg command is highly useful for system administrators and IT professionals handling Windows registry operations.

Key Uses of reg

  • Query the Registry: Retrieve information about specific registry keys and values.
  • Modify the Registry: Add, delete, or change registry keys and values.
  • Backup and Restore: Export the current registry state for backup or import it to restore settings.
  • Remote Management: Apply registry operations to remote machines.

How to Use the reg Command

The reg command has several subcommands to perform various registry operations.

Basic Syntax

Image showing command prompt "reg" options
reg <operation> [options] <registry-path>

Operations:

  • reg add: Add a new subkey or value.
  • reg delete: Remove a subkey or value.
  • reg query: Query the list of subkeys and values.
  • reg export: Export a section of the registry to a file.
  • reg import: Import registry settings from a file.
  • reg save: Save a copy of the registry.
  • reg restore: Restore the registry from a backup.

Examples

  1. Add a New Registry Key
   reg add HKCU\Software\Tamaglo\MyApp

Explanation: This command adds a new key under HKCU\Software\Tamaglo\MyApp.

  1. Delete a Registry Value
   reg delete HKCU\Software\Tamaglo\MyApp /v MyValue

Explanation: This deletes the MyValue entry within the MyApp key.

  1. Query a Registry Key
   reg query HKCU\Software\Tamaglo\MyApp

Explanation: Lists the values and data in the specified key.

  1. Export a Registry Key
   reg export HKCU\Software\Tamaglo C:\Backup\TamagloBackup.reg

Explanation: Exports the registry settings from Tamaglo to a file for backup.

  1. Import Registry Settings
   reg import C:\Backup\TamagloBackup.reg

Explanation: Imports previously exported registry settings.

What is the regini Command?

The regini command is another tool for managing Windows registry settings, specifically through text files. It allows administrators to define registry structure and permissions in a text file and apply those settings across multiple systems or remote systems. This is particularly useful when automating large-scale registry changes.

Key Uses of regini

  • Set Registry Permissions: Define access permissions for specific registry keys.
  • Apply Registry Settings Remotely: Push registry configurations to remote computers.
  • Manage Registry Structure: Set up or modify registry keys and values through structured text files.

How to Use the regini Command

Image showing command prompt "regini" options

Basic Syntax

regini [options] <textfile>

Options:

  • /m <\\computername>: Modify the registry on a remote computer.
  • /h <hivefile hiveroot>: Load a specific registry hive.
  • /i <n>: Specify the indentation level for the registry hierarchy.

Examples

  1. Apply Registry Settings from a Text File
   regini C:\Scripts\RegSettings.txt

Explanation: Applies the registry settings defined in RegSettings.txt to the local registry.

  1. Change Registry on a Remote Computer
   regini /m \\RemotePC C:\Scripts\RegSettings.txt

Explanation: Applies the settings in RegSettings.txt to the registry on RemotePC.

  1. Customizing Registry Structure In the text file RegSettings.txt, you might define a structure like this:
   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService
   Start = REG_DWORD 0x2

Explanation: This sets the startup type for MyService via a text file, which can be applied using regini.

Comparison of reg and regini

Featurereg Commandregini Command
Primary PurposeGeneral registry operations (add, delete, query, etc.)Apply registry settings using text files
Local/RemoteWorks on local and remote systemsPrimarily used for remote or multiple systems
Key FunctionsExport, import, query, backup, restore, etc.Modify permissions, set registry structure
Best forDirect registry manipulationAutomating registry settings for multiple systems
Example Usagereg query HKCU\Software\Tamagloregini /m \\RemotePC RegSettings.txt

When to Use reg

  • When you need to add, delete, or query individual registry keys or values quickly.
  • For tasks such as exporting and importing registry settings, or performing backups.
  • When you need to manage both local and remote registries interactively.

When to Use regini

  • For applying the same registry settings across multiple systems at once.
  • When managing permissions or registry structure using a predefined template.
  • For remote registry modifications that can be done through scripts and text files.

Conclusion

The reg and regini commands are both powerful tools for managing the Windows registry. reg is ideal for day-to-day registry operations such as querying, adding, deleting, or backing up keys. regini, on the other hand, excels at automating registry changes across multiple systems through text files. By understanding how to use each of these tools effectively, administrators can streamline their registry management tasks.

Tamaglo

Thank you for reading!

Comments

To comment

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here

目次