I've been messing around with the windows recycle bin lately, and figured out that I could rename it in file explorer, so I tried doing that with batch. I found HKEY_CLASSES_ROOT\CLSID{645FF040-5081-101B-9F08-00AA002F954E} to be the registry key of interest, as it contains lots of info about the recycle bin.
But modifying anything inside it seemed completely impossible, even using other tools like PowerShell or Nircmd. Does anyone have any clue on how I could at all change values inside that key using any programming language? Here's the command I tried to use:
reg add "HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}" /v "" /t REG_SZ /d "New Name" /f
Edit: I've done some more experimenting, and apparently I have to change the ownership of the key to myself, now I just have do figure out how to do that with batch. Using a programming language to change the ownership of that key seems to be even more difficult. Now I'm really stuck...
There is an access restriction for the HKEY_CLASSES_ROOT key you mentioned, in the HKEY_LOCAL_MACHINE\SOFTWARE\Classes branch, (only Trusted Installer has Full Control).
As I received no feedback from my comments, I decided to attempt the task of renaming the Recycle Bin
on the Desktop of a customer's computer, (Windows 10 Pro), using the HKEY_CURRENT_USER\Software\Classes\ClsID
registry branch, (as per my comments).
The first thing I noted was, for the task you explained, you were attempting to modify the wrong registry value, i.e. the (default)
value as opposed to the LocalizedString
value.
The following is my attempt to change the name of the currently logged in user's own 'Recycle Bin', not everyone's, with a single line batch file:
@"%SystemRoot%\System32\reg.exe" Add "HKCU\SOFTWARE\Classes\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}" /V "LocalizedString" /T REG_EXPAND_SZ /D "%%UserName%%'s trash" /F 1>NUL
I used the F5 hotkey to refresh the Desktop and it worked exactly as expected.
You'll note that I used an environment variable in the REG_EXPAND_SZ key for my example. This has the benefit of showing the correct user's name, even if it is later changed. You can, if you wish, just use standard text in there, but please do not change the data type to REG_SZ.