cmd - Cannot edit registry via BAT file but command-line works fine -


so strange thing happend today. writing *.bat edits registry values. example, let's command this:

@echo on  reg add "hkey_current_user\software\microsoft\windows\currentversion\policies\explorer" /v "nopreviewpane" /t reg_dword /d "2" /f  pause 

if type (paste) elevated cmd, works should. if create *.bat file command , run it: - run administrator: cmd opens , closes, , nothing happens - run normally: "access denied" - ok, because editing cmd requires admin rights, afaik.

any ideas wrong?

the hkey_current_user changes when current user changes (i.e. administrator).

you need make script write relevant sub-key of hkey_current_users instead - note s @ end. (see here bit more on this.)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -