- Local time
- 3:08 PM
- Posts
- 3,333
- Location
- CurrentCounty
- OS
- Windows 11 Home x64 Version 23H2 Build 22631.3447
Based on all the info posted so far & my own experiments, I think that the Context menu, New, Bitmap image entry can be removed automatically using a batch file that calls NirSoft RegScanner.
I've used more time than I had intended on this and I've got to go because my stomach is now convinced that my throat has been cut and is demanding retribution.
I've only experimented with Stage 1 so far but I've added comments about the later Stages below so you can understand what I'm on about.
Stage 1 These commands, which need to be run as Admin, produce readily readable output files. Either could be considered, one might turn out to be easier to work with in the sub-routine within Stage 2.
RegScanner.exe /cfg "H:\TestFolder\regscanner.cfg" /stext "H:\TestFolder\STXTOutput.txt"
RegScanner.exe /cfg "H:\TestFolder\regscanner.cfg" /sxml "H:\TestFolder\sxmlOutput.xml"
Both commands produce an output that identifies the Registry Key & Name entry/entries that need to be worked on in this particular computer.
Stage 2 The output file can be read using a For command in the form
For /f "usebackq tokens=*" %%X in ("%SourceFile%") do Call :Processing "%%X"
in which the Processing sub-routine
- I always use sub-routines for processing For command results. I find this makes for code that can be developed incrementally, that can be experimented with safely, that is readily understandable and that is straightforwards to debug.
Stage 3 The single or multiple Registry key & Name entries are then used in a Reg Delete command that removes the Data entry for the found Keys-Names.
I don't know when I will have time to return to this topic.
All the best,
Denis
I've used more time than I had intended on this and I've got to go because my stomach is now convinced that my throat has been cut and is demanding retribution.
I've only experimented with Stage 1 so far but I've added comments about the later Stages below so you can understand what I'm on about.
Stage 1 These commands, which need to be run as Admin, produce readily readable output files. Either could be considered, one might turn out to be easier to work with in the sub-routine within Stage 2.
RegScanner.exe /cfg "H:\TestFolder\regscanner.cfg" /stext "H:\TestFolder\STXTOutput.txt"
RegScanner.exe /cfg "H:\TestFolder\regscanner.cfg" /sxml "H:\TestFolder\sxmlOutput.xml"
Both commands produce an output that identifies the Registry Key & Name entry/entries that need to be worked on in this particular computer.
- A manual run of the RegScanner.exe user interface is needed beforehand so an initial, generic, default Cfg file can be saved & copied to a convenient folder.
- Then, a specific Cfg file needs to be saved when running the RegScanner user interface to include the ShellNewDisplayName_Bmp search term & selecting only the HKCR Registry Hive.
- That specific Cfg file can then be copied to, say, the folder that the batch file is to be run from.
- The initial, generic, default Cfg file can then be copied back to the RegScanner folder so that the tool not condemned to always run the search required for this particular job. [I think merely deleting all Cfg files from the RegScanner.exe folder will also achieve the same end.]
Stage 2 The output file can be read using a For command in the form
For /f "usebackq tokens=*" %%X in ("%SourceFile%") do Call :Processing "%%X"
in which the Processing sub-routine
- checks that results have been obtained [my Win11-upgraded-from-Win10 computer does not have any of these HKCR Keys so will return no real results].
- checks that the rest of the Data : entry in both Keys are not blank or, for the xml version, that the <data/> entry exists in both because they mean the job had already been done
- if the job has not already been done for either entry, extracts the Registry Key : or <registry_key> lines and the Name : or <name> lines then tidies up those values by removing superfluous text from them.
It is use of the For command that allows the script to cope with both single & multiple HKCR Keys in the results.- I always use sub-routines for processing For command results. I find this makes for code that can be developed incrementally, that can be experimented with safely, that is readily understandable and that is straightforwards to debug.
Stage 3 The single or multiple Registry key & Name entries are then used in a Reg Delete command that removes the Data entry for the found Keys-Names.
I don't know when I will have time to return to this topic.
- I don't feel like treating this as a high priority but I do believe it is all feasible.
- I really do not like using intermediate files such as the .txt / .xml files generated in Stage 1 but that's how the NirSoft RegScanner tool is designed to work in its command line mode.
- I use scripts that can be run in Windows 10 & 11 without alternation so, for this one, I'd add in an OS check at the start so I can escape if the OS is Windows 10.
- I store all my scripts, such as this batch file, and all my portable utilities, such as RegScanner, within subfolders of C:\Tools, a folder I create on all my computers for this purpose. Set up my C:\Tools folder - TenForums
All the best,
Denis
Last edited:
My Computer
System One
-
- OS
- Windows 11 Home x64 Version 23H2 Build 22631.3447