windows - Why can a double clicked batch file not find a registry value for deletion? -


i wrote bat file delete registry entry.

reg delete hkey_local_machine\software\microsoft\windows\currentversion\run /v value /f 

when execute in cmd, works.

but when execute double click, doesn't!!!

error message:

error: system not find specified registry keys or values 

anyone else can tell me why!

on 64-bit windows there automatic start of 64-bit applications

hkey_local_machine\software\microsoft\windows\currentversion\run

and automatic start of 32-bit applications

hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\run

if batch file executed 32-bit cmd.exe in directory %systemroot%\system32\ being automatically redirected 32-bit applications %systemroot%\syswow64\, registry path

hkey_local_machine\software\microsoft\windows\currentversion\run

is automatically redirected to

hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\run

if batch file executed 64-bit cmd.exe in directory %systemroot%\system32\, can called 32-bit applications on windows x64 using redirector %systemroot%\sysnative\ instead of %systemroot%\system32\, registry path

hkey_local_machine\software\microsoft\windows\currentversion\run

is indeed referencing

hkey_local_machine\software\microsoft\windows\currentversion\run

so suppose value exists in run key 32-bit applications (below wow6432node), batch file on double click executed 64-bit cmd.exe because 64-bit windows explorer used. therefore value cannot found in run key 64-bit applications.

the solution use

%systemroot%\sysnative\reg.exe delete hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\run /v value /f 

please note special redirector %systemroot%\sysnative\ exists on 64-bit windows , 32-bit applications, not exist on 32-bit windows. take consideration if batch file should work 32-bit windows.

for more information redirections on windows x64 read msdn articles


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -