Community
    • Login

    open/edit files without extension

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 1.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • IDizorI
      IDizor
      last edited by

      Initially I planned to add a new comment here:
      https://community.notepad-plus-plus.org/topic/17472/open-edit-files-without-extension
      but the thread is locked (yep, another community with this stupid rule to lock old threads, even unresolved ones). Okay then, take a new one:
      ef7d916c-9d4c-440a-9e71-4dd43fe206a6-image.png
      this dialog appears when default Windows notepad is replaced with Notepad++, and I am trying to open hosts file from the command line:

      notepad.exe "C:\Windows\System32\drivers\etc\hosts"
      

      Default notepad is replaced by registry change:

      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
      "Debugger"="\"C:\\Program Files\\Notepad++\\Notepad++.exe\" -notepadStyleCmdline -z"
      

      I know a workaround for this, but this looks to be a bug in Notepad++.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @IDizor
        last edited by

        @idizor ,

        Notepad++ on its own has no difficulty in opening the hosts file with no extension, whether it is done from the File>Open menu inside notepad, or right clicking on hosts in Windows Explorer and choosing to open with Notepad++, or from the command line "c:\program files\notepad++\notepad++.exe" "c:\windows\system32\drivers\etc\hosts".

        I have never used that hack of the OS to get Notepad++ to replace notepad.exe; the OS has multiple built-in methods of associating text files with a different application instead of Notepad++, and I always use those, rather than a workaround hack, and those work 100% reliably for me. (Open With, using the registry to edit the txtfile or .txt registry entries, or just using the right click “edit with notepad++” or equivalent key that gets applied in the * key to apply to all file types.)

        I don’t have admin privileges at work, so I cannot try the HKLM edit that is required for that hack, so I cannot confirm or contradict your experience with that hack. And I think the -notepadStyleCmdline option only works in that hack, so I cannot confirm whether it tries to auto-add the .txt extension from the command line using that option.

        I highly recommend using a normal Windows OS methodology of associating the files you want with Notepad++ instead of the hack.

        IDizorI 1 Reply Last reply Reply Quote 1
        • IDizorI
          IDizor @PeterJones
          last edited by

          @peterjones than you for the answer.

          I agree that standard Windows associating methodology can cover a major number of usecases when working with text files. But sometimes Windows or some apps open files for you without asking what editor to use (under the hood they call default notepad in similar way like I specified above).

          It looks like the parameter -notepadStyleCmdline was created specifically for this “hack” with replacing default notepad, but there is something wrong with parameter processing in NPP.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors