How do I associate extensionless files with an application?


  1. Posts : 3
    Windows 7 Ultimate x64
       #1

    How do I associate extensionless files with an application?


    This used to be simple to do in XP[1], but I can't figure out how to do it in Win7 (Ultimate edition).

    Currently extensionless files open by default in notepad (yes I have the show file extensions option enabled).

    When I try to use the Open With dialog to associate the Scite editor with such files, the Always use the selected program option is greyed out.

    I've tried the XP trick of adding a . (dot) key in HKEY_CLASSES_ROOT. If I add the key OpenWithList to it, and then and a subkey scite.exe, the OpenWith context menu will show scite. But it still doesn't allow me to set it as the default viewer.

    So how do I set scite.exe to be the default viewer for extensionless files?

    [1]: Associate Extensionless Files with Notepad in WinXP : Perishable Press
      My Computer


  2. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
       #2

    Hello Drey, and welcome to Seven Forums.

    The file is going to need a file extension in order for to be able to be associated to be opened with a program of your choice.

    You can do so by renaming the file to give it a file extension (ex: name.blank), then use Open with to select a program to always open it.

    Hope this helps, :)
    Shawn
      My Computer


  3. Posts : 3
    Windows 7 Ultimate x64
    Thread Starter
       #3

    Brink said:
    The file is going to need a file extension in order for to be able to be associated to be opened with a program of your choice.
    That wasn't true in XP, and there's likely a way to make it work in Win7. Extensionless files are common in Posix, e.g. README files, and some applications might require files to have a name without an extension. You can't always rename these files, for example they might be a part of a project in source code repository.
      My Computer


  4. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
       #4

    If the file doesn't have a file extension, then you can still open them with any program you like, but they will not be associated to open with the program by default unless it does have a file extension.
      My Computer


  5. Posts : 3
    Windows 7 Ultimate x64
    Thread Starter
       #5

    Ok I figured it out thanks to a superuser answer. You have to associate the Open command with your editor of choice. Here's a sample registry file:

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\.]
    @="txtfile"
    
    [HKEY_CURRENT_USER\Software\Classes\txtfile\shell\open\command]
    @="\"D:\\Apps\\Scite\\Scite.exe\" \"%1\""
    I guess you could associate a different class for the extensionless file, but I use txtfile for simplicity.

    Perhaps this could be added to the Tutorials section?
      My Computer


  6. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
       #6

    I would think that would cause issues when you tried to open any .txt file since they would be opened by that program as well.

    Otherwise, it would basically be the same as setting all .txt file types to open with that program in Default Programs.
      My Computer


  7. Posts : 6,285
    Windows 10 Pro X64
       #7

    Shawn, are you sure? When I look at my Win 8 system, there is no

    HKEY_CLASSES_ROOT\.

    There is a

    HKEY_CLASSES_ROOT\*


    so it seems like adding the registry data drey shows would work and not affect files with .txt extensions.

    Guess I'll try it and see what happens.
      My Computer


  8. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
       #8

    You're right Rich. I had thought that was a tiny * instead of . in the code box.
      My Computer


  9. Posts : 6,285
    Windows 10 Pro X64
       #9

    That worked perfectly. I set it to use the X2 editor and when I double click on a file with no extension it opens in X2. When I click on a .txt file it opens in Notepad.
      My Computer


 

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

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