WildlandsTech
Comprehensive List of SWReg Commands with Descriptions - Printable Version

+- WildlandsTech (https://wildlandstech.com)
+-- Forum: Programming (https://wildlandstech.com/forumdisplay.php?fid=3)
+--- Forum: Batch & Shell Scripting (https://wildlandstech.com/forumdisplay.php?fid=42)
+--- Thread: Comprehensive List of SWReg Commands with Descriptions (/showthread.php?tid=162)



Comprehensive List of SWReg Commands with Descriptions - Sneakyone - 09-03-2024

Comprehensive List of SWReg Commands with Descriptions

**SWReg** is a command-line utility used for managing the Windows Registry. It allows you to add, delete, query, and modify registry keys and values. Below is a detailed list of SWReg commands, along with descriptions and examples.



1. Adding a Registry Key
Description: Creates a new registry key in the specified path.
Code:
swreg add [RootKey]\[SubKey]
Example: To add a new key `MySoftware` under `HKEY_CURRENT_USER\Software`:
Code:
swreg add HKEY_CURRENT_USER\Software\MySoftware

2. Adding a Registry Value
Description: Creates a new value under a specified registry key.
Code:
swreg add [RootKey]\[SubKey] /v [ValueName] /t [Type] /d [Data]
Example: To add a `String` value `Version` with data `1.0` under `MySoftware`:
Code:
swreg add HKEY_CURRENT_USER\Software\MySoftware /v Version /t REG_SZ /d 1.0

3. Deleting a Registry Key
Description: Deletes a specified registry key and all its subkeys.
Code:
swreg delete [RootKey]\[SubKey]
Example: To delete the `MySoftware` key under `HKEY_CURRENT_USER\Software`:
Code:
swreg delete HKEY_CURRENT_USER\Software\MySoftware

4. Deleting a Registry Value
Description: Deletes a specific value from a registry key.
Code:
swreg delete [RootKey]\[SubKey] /v [ValueName]
Example: To delete the `Version` value from the `MySoftware` key:
Code:
swreg delete HKEY_CURRENT_USER\Software\MySoftware /v Version

5. Querying a Registry Key or Value
Description: Queries and displays the contents of a specified registry key or value.
Code:
swreg query [RootKey]\[SubKey]
Example: To query the contents of the `MySoftware` key:
Code:
swreg query HKEY_CURRENT_USER\Software\MySoftware

6. Modifying a Registry Value
Description: Modifies the data of an existing registry value.
Code:
swreg add [RootKey]\[SubKey] /v [ValueName] /t [Type] /d [NewData] /f
Example: To modify the `Version` value to `2.0`:
Code:
swreg add HKEY_CURRENT_USER\Software\MySoftware /v Version /t REG_SZ /d 2.0 /f
Note: The `/f` flag forces the overwrite of the existing value without prompting.

7. Exporting a Registry Key to a File
Description: Exports a specified registry key to a `.reg` file for backup or transfer.
Code:
swreg export [RootKey]\[SubKey] [FilePath]
Example: To export the `MySoftware` key to `backup.reg`:
Code:
swreg export HKEY_CURRENT_USER\Software\MySoftware C:\backup.reg

8. Importing a Registry Key from a File
Description: Imports registry keys and values from a `.reg` file into the registry.
Code:
swreg import [FilePath]
Example: To import keys and values from `backup.reg`:
Code:
swreg import C:\backup.reg

9. Listing Subkeys and Values in a Key
Description: Lists all subkeys and values under a specified registry key.
Code:
swreg list [RootKey]\[SubKey]
Example: To list all subkeys and values under `MySoftware`:
Code:
swreg list HKEY_CURRENT_USER\Software\MySoftware

10. Checking If a Registry Key Exists
Description: Checks if a specified registry key exists.
Code:
swreg exists [RootKey]\[SubKey]
Example: To check if the `MySoftware` key exists:
Code:
swreg exists HKEY_CURRENT_USER\Software\MySoftware

11. Displaying Help Information
Description: Displays help information for the SWReg command, listing all available options and their descriptions.
Code:
swreg /?
Example: To display help information for SWReg:
Code:
swreg /?



Conclusion

The **SWReg** command-line utility is a powerful tool for managing the Windows Registry, making it an essential utility for system administrators, developers, and power users. By mastering these commands, you can efficiently manage registry keys and values, automate registry tasks, and maintain system configurations.

Happy Registry Management!