Setting Notepad++ as default text editor requires changing a reg key

Page 1 of 2 12 LastLast

  1. Posts : 425
    Windows 10
       #1

    Setting Notepad++ as default text editor requires changing a reg key


    I'm trying to set the permissions of a registry key from the command line. Easy to do in regedit, but this is all part of a system customization script.

    The command line is;

    regini -h HKEY_CURRENT_USER\software\microsoft\windows\currentversion\explorer\fileexts\.txt\userchoice [1 5 7] test.txt

    But it fails with;

    REGINI: Failed to load from file '5' (3)

    [1 5 7] are the permissions I'm trying to set, and test.txt contains;

    ProgID = REG_SZ Applications\notepad++.exe

    (Key name, type and the value I'm trying to set)

    Windows 10 1809; Regini /? for help.

    What am I doing wrong?
      My Computer


  2. Posts : 5,330
    Windows 11 Pro 64-bit
       #2

    You can use Reg.exe command-line for example below command makes Notepad++ default batch script (.bat) editor.

    Code:
    Reg.exe add "HKCR\batfile\shell\edit\command" /ve /t REG_EXPAND_SZ /d "\"C:\Program Files\Notepad++\notepad++.exe\" \"%%1\"" /f
      My Computer


  3. Posts : 425
    Windows 10
    Thread Starter
       #3

    Thanks for that.

    I already have something similar already configured.

    I had set it to be the default replacing notepad. To accomplish that the registry tweak I mentioned is required. I can easily do this after a system is installed with regedit, but I'm trying to make the whole process as automatic as possible.
      My Computer


  4. Posts : 6,852
    22H2 64 Bit Pro
       #4

    I use a few other text editors. To make Notepad++ run in place of notepad use IFEO.

    Code:
    reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%ProgramFiles%\Notepad++\notepad++.exe\" -notepadStyleCmdline -z" /f
      My Computer


  5. Posts : 5,048
    Windows 10/11 Pro x64, Various Linux Builds, Networking, Storage, Cybersecurity Specialty.
       #5
      My Computer


  6. Posts : 425
    Windows 10
    Thread Starter
       #6

    How to changhe registry permissions from the command line


    Hi @Compumind. Thanks for the link.
    I had already seen that.

    What I'm looking for is assistance with the regini command.

    Specifically why does this command fail.
    regini -h HKEY_CURRENT_USER\software\microsoft\windows\currentversion\explorer\fileexts\.txt\userchoice [1 5 7] test.txt

    I need to change the title of this post. It should read "How to change registry permissions from the command line"

    - - - Updated - - -

    Callender said:
    I use a few other text editors. To make Notepad++ run in place of notepad use IFEO.

    Code:
    reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%ProgramFiles%\Notepad++\notepad++.exe\" -notepadStyleCmdline -z" /f
    Yes, I've seen that too on ghacks and winaero.

    What I'm after is finding out why the regini command fails. I want to change permissions of a registry key from the command line so I can add it to a setupcomplete.cmd script.

    Notepad++ was just one example of where this is needed, but is not the only reason for changing permissions on registry keys. There are others.
      My Computer


  7. Posts : 989
    Microsoft Windows 10 Home
       #7

    I think you may be having issues because of the key you're trying to edit.

    HKCU\...\FileExts seems to have some magical extra protction from modificat by applicatons/scripting.

    I'm not familiar with regini, but I would suggest testing on a dummy key of your own creation (outside of FileExts & its subkeys). If a similar command successfully modifies those permissions, your problem is not with regini or your syntax, but the key itself.
      My Computer


  8. Posts : 6,852
    22H2 64 Bit Pro
       #8

    Wobitancrawfodi said:
    What I'm looking for is assistance with the regini command.

    Specifically why does this command fail.
    regini -h HKEY_CURRENT_USER\software\microsoft\windows\currentversion\explorer\fileexts\.txt\userchoice [1 5 7] test.txt
    I need to change the title of this post. It should read "How to change registry permissions from the command line"
    What I'm after is finding out why the regini command fails. I want to change permissions of a registry key from the command line so I can add it to a setupcomplete.cmd script.
    Notepad++ was just one example of where this is needed, but is not the only reason for changing permissions on registry keys. There are others.
    It's above my pay grade but maybe something to do with UserChoice Hash:

    SetUserFTA: UserChoice Hash defeated – Set File Type Associations per User or Group on Windows 8/10 and 2012/2016/2019 – the kolbicz blog
      My Computer


  9. Posts : 6,852
    22H2 64 Bit Pro
       #9

    Well I see a hash here:

    Setting Notepad++ as default text editor requires changing a reg key-registry-editor.jpg
      My Computer


  10. Posts : 6,852
    22H2 64 Bit Pro
       #10

    Okay I just set Notepad++ Portable as default after some messing about and it has it's own hash.

    Setting Notepad++ as default text editor requires changing a reg key-registry-editor-2.jpg

    It would not set as default unless I used OpenwithAdd first.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:12.
Find Us




Windows 10 Forums