Zend certified PHP/Magento developer

(?) Replace name of user folder in ALL registry path values [closed]

I have changed the name of my user folder from “userABC” to “userDEF”, and just for neatness sake I would like this change to appear in all registry path values that previously pointed to the old user profile path. Using this path as an example:

DeviceHarddiskVolume7UsersuserABCDownloads(File)

After the desired change:

DeviceHarddiskVolume7UsersuserDEFDownloads(File)

I need every instance of “userABC” to be replaced with “userDEF” in:

HKEY_CLASSES_ROOT

HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

HKEY_USERS

HKEY_CURRENT_CONFIG

This is a find and replace operation. The computer I will test this on (Windows 11 Home) does not contain any valuable data, and is separate from my main PC.

I have already updated the new user folder name in the system environment variables, and in all programs that have depended on the previous path. This is the last step to fully transition to the new change across the entire system. I am looking for answers only to the following question, and I am also aware that there are better approaches to this than what I have described. I am mainly curious about how to perform this specific operation.

How can I use Powershell or Batch to run this process, and is there a better tool or program that comes to mind for a solution to the problem?

However, feel free to answer how you would like. Thank you and welcome to my first question.