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

trevorshiloh

New member
Local time
11:01 AM
Messages
4
Hi,

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

unknown.png


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:

unknown.png


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 My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Probook 455 G3
OS
Windows 7 Home Premium x64
CPU
AMD A8-7410 APU
Memory
4 GB
Graphics Card(s)
AMD R5
Hard Drives
500 GB HDD
Antivirus
Malwarebytes Anti Malware, RKill, GMER, AdwCleaner, MSE
Browser
Google Chrome, Internet Explorer, Mozilla Firefox
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 My Computer

Computer type
PC/Desktop
OS
win 8 32 bit
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 My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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).


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 :p
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
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 My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Probook 455 G3
OS
Windows 7 Home Premium x64
CPU
AMD A8-7410 APU
Memory
4 GB
Graphics Card(s)
AMD R5
Hard Drives
500 GB HDD
Antivirus
Malwarebytes Anti Malware, RKill, GMER, AdwCleaner, MSE
Browser
Google Chrome, Internet Explorer, Mozilla Firefox
... 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 My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP (HP-P6212F)
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
Motherboard
PEGATRON CORPORATION Benicia
Memory
6.00 GB
Graphics Card(s)
Intel(R) G33/G31 Express Chipset Family
Sound Card
Realtek High Definition Audio
Monitor(s) Displays
24'' HP WS LCD
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
(1) ATA Hitachi HDT72106 SCSI Disk Device (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) Verbatim STORE N GO USB Device
Keyboard
Logitech G510s
Mouse
Logitech Trackball M570
Antivirus
Microsoft Security Essentials / Malwarebytes
Browser
IE / Firefox / Chrome
Back
Top