CMD.bat script - Error REG DELETE statement
Bigstarblue last edited by
Cordial greetings to the entire community.
I appreciate in advance the help you can offer me. It is the first time that I enter this Forum. I’m Hispanic; I do not speak English very well, so I respectfully ask for your understanding.
Alright, let’s get to the point of the problem:
Target : CMD.bat script - Clear error REG DELETE statement Problem : "ERROR: REG DELETE Cannot find the specified registry key or value" Version Notepad++ : v7.9 (32-bit) Portable Operating system : Windows 7 Ultimate x64 Service Pack 1
I present the case:
My problem with Notepad++ is in the execution of a .bat script launched from the editor.
The goal is to remove a specific key from the Windows Registry.
SCENARIO #1 (Successful case!!) --------------------------------- Key #1 : HKEY_CLASSES_ROOT\SOFTWARE\123 Instruction #1 : REG DELETE HKCR\SOFTWARE\123 /F Execution result : The 123 key is deleted. "The operation was completed correctly" SCENARIO #2 (ERROR generated by N++) -------------------------------------- Key #2 : HKEY_LOCAL_MACHINE\SOFTWARE\123 Instruction #2 : REG DELETE HKLM\SOFTWARE\123 /F Execution result : "ERROR: The system could not find the 123 key or the specified registry value"
To test if Instruction #2 was wrong, I tried these other two options:
A) Instruction #2 was executed directly on the command line of a CMD window Execution result : The 123 key is deleted. "The operation was completed correctly" (Successful case!!) B) The .bat script edited in N++ which contains Instruction #2 was executed, directly from Explorer and from CMD Execution result : The 123 key is deleted. "The operation was completed correctly" (Successful case!!)
The question that arises from this is:
¿How is it that N++ is able to execute the REG DELETE operation of SCENARIO #1 correctly, while that of SCENARIO #2 cannot carry it out and marks ERROR?
¿If options A) and B) produced successful results for SCENARIO #2 checking that there is no error in the instruction, what happens with N++ that when launching the .bat script from the editor, it is not able to complete satisfactorily the operation and hangs on ERROR?
I really appreciate your responses and the interest you have in reading my message.
dinkumoil last edited by dinkumoil
Though you are baking cookies I’ll give you a hint:
You use a 32 bit version of Notepad++ on a 64 bit version of Windows. It seems like the
cmd.exeyou start from Notepad++ to execute your batch script is a 32 bit process as well. 32 bit processes can not access 64 bit branches of the registry because they do not “see” them. Instead, Windows uses registry virtualization to redirect them to the related 32 bit branch of the registry.
If you try to access
HKEY_LOCAL_MACHINE\SOFTWARE\123you actually get the key
The solution is to start a 64 bit
cmd.exe(the one from
C:\Windows\System32) to execute your batch script.
Bigstarblue last edited by
I thank you for the interest you had in helping me. I really appreciate your help.
You were absolutely right. The problem was with the 32-bit version of N++ I was using. I changed it to 64-bit and it worked perfectly.
Explanation more than simple and clear !!!
Thank you again,