2

I have several processes that generate files with no extension at all and would like to add a custom context menu menu (i.e. be able to right click on them and select 'open in Notepad' or 'make .txt file' etc)

I know I can associate (add) a command (e.g. "OpenNotepad") for a particular filetype (extension), or all filetypes...

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\Shell\OpenNotepad]    ​      <--  All files/folders
[HKEY_CLASSES_ROOT\txtfile\Shell\OpenNotepad]    ​<-- .txt files

But how can I do this for files that have no extension?...

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ ?? \Shell\OpenNotepad]      ​<--  Files with no extension?
1
  • Happy to provide an example, but don't want to get too side-tracked... So, for as example, Windows downloads Spotlight login page background images to: %LocalAppData%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets. They are JPEG-format images (.JPG) but are stored as extensionless-GUIDs (e.g. 2e2156afe6cf9fc53c0cd36177d1216ccb0986dbdea7183d6a337db055ec041b)
    – Martin
    Commented Jun 5, 2021 at 15:40

2 Answers 2

1

To add shell menu entries for files with no extension, use this registry branch:

[HKEY_CLASSES_ROOT\.\Shell]

Example:

[HKEY_CLASSES_ROOT\.\Shell\OpenNotepad]

References:

1
  • Registry export for VS Code
    – JW0914
    Commented Jun 18, 2021 at 11:00
0

Doing so for text editors other than NotePad is slightly different due to whitespaces in the path:

  • CLI:
    1. Open an Admin terminal: WinKey+ROpen: powershellCtrl+Shift+OK
    2. # Associates no extension files with VS Code: (path must be double backslashed)
        # Quotes around %1 allow for files with whitespaces in names
        Reg Add 'HKCR\.\shell\open\command' /t REG_SZ /d '"C:\\Program Files\\VS Code\\Code.exe" "%1"'
      

  • GUI:
    1. Save as No-Ext Association.reg:
      Windows Registry Editor Version 5.00
      
      [HKEY_CLASSES_ROOT\.]
      @=""
      
      [HKEY_CLASSES_ROOT\.\shell]
      
      [HKEY_CLASSES_ROOT\.\shell\open]
      
      [HKEY_CLASSES_ROOT\.\shell\open\command]
      @="\"C:\\Program Files\\VS Code\\Code.exe\" \"%1\""
      
    2. Import into Registry via:
      • Opening No-Ext Association.reg from Explorer
      • Admin terminal:
        Reg Import ".\No-Ext Association.reg"
        

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .