How do I make a dot file type recognized as a text file (e.g. .args)


  1. Posts : 4
    Windows 7 Home Premium x64
       #1

    How do I make a dot file type recognized as a text file (e.g. .args)


    Hi,

    I know in windows 7 you can create files without names such as ".args" or ".gitignore". I have one of each of these.



    My question is, how does windows know that the .gitignore file is a "Text Document" and can I make the same thing happen to my .args file? If I make the default program notepad, the icon changes to this:



    But windows still treats it as an "ARGS File" instead of a "Text Document".


    Does anyone know how to get windows to recognize custom file types as text documents and for the .txt icon to be used?

    Thanks.

    Trevor
      My Computer


  2. Posts : 3,787
    win 8 32 bit
       #2

    In simple terms Windows displays the icon for a file by what's designed to open it so if you tell Windows to open .Fred with notepad it then thinks it's a txt file. At a deeper level the headers of the file say what it is even a txt file can have different headers to say what type of txt file its and how it's encoded
      My Computer


  3. Posts : 0
    Windows 7 Ultimate x64
       #3

    I would just install Notepad ++ then all you have to do is right click the file and open with Notepad ++ to view that file. I do this all the time with many files. I even do it with pictures to look at its headers, etc.
      My Computer


  4. Posts : 2,468
    Windows 7 Ultimate x64
       #4

    There is no such thing in Windows like a "dot file" (or there is, but aren't special in any way). Windows Explorer uses the file extension to determine the "file type". Dot files are 100% extension, so each one is technically a different type. In your case the gitignore extension has a text file type, but the args extension had none, then the useless you created with the useless "default programs" Control Panel applet. As each file has different extension, each one is a different type.

    To change this, look in the registry for the appropriate entries. Go to HKEY_CLASSES_ROOT\.gitignore and look at the "(default)" value. That's its current association. Copy that value into HKEY_CLASSES_ROOT\.args into its "(default)" entry and you're done, both files will behave the same. You'll need to restart Explorer in order for the change to take effect (usually, logoff and login again).


    samuria said:
    In simple terms Windows displays the icon for a file by what's designed to open it so if you tell Windows to open .Fred with notepad it then thinks it's a txt file. At a deeper level the headers of the file say what it is even a txt file can have different headers to say what type of txt file its and how it's encoded
    It doesn't work that way. Windows Explorer has no idea of what program is designed to open what file. In fact it doesn't even opens the file, much less look at its headers (Linux does this partially with the shebang syntax). Explorer only relies on file extension to assing a "file type" according to the rules in the registry, and those rules define what program is launched on each action. Whether it's appropriate or not, it's not relevant, it's all about file association.
    Nitpick: It's Windows Explorer what does all this, not Windows. The OS is utterly unaware and doesn't even cares about all this
      My Computer


  5. Posts : 4
    Windows 7 Home Premium x64
    Thread Starter
       #5

    Thank you Alejandro for the in-depth analysis. Everyone else, thanks but my problem wasn't how to open the file in n++ or notepad etc, I wanted it to display nicely with the .txt icon, but the notepad icon.
      My Computer


  6. Posts : 1,364
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #6

    trevorshiloh said:
    ... I wanted it to display nicely with the .txt icon, but the notepad icon.
    most any file can have it's own custom icon, if that's you're ulterior goal.
      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 10:29.
Find Us