How to set the default program for opening files without an extension in Windows?
11 Answers
With the command line:
assoc .="No_Extension"
ftype "No_Extension"="C:\path\to\my editor.exe" "%1"
Restart the computer for the changes to take effect.
To give credit, I learned this from the vim wikia here and here
Extra info:
Instead of "C:\path\to\...", the following macros may be useful:
%SystemDrive%- drive windows is installed on, i.e.C:\%ProgramFiles%- e.g."C:\Program Files\"%ProgramFiles(x86)%- e.g."C:\Program Files (x86)\"
You will need to properly escape them though:
ftype "No_Extension"=^"^%ProgramFiles(x86)^%\Notepad++\notepad++.exe^" "%1"
To set the icon to be the same as .txt files (I didn't do this, since it automatically made the files' icons display as Notepad++ files):
assoc "No_Extension"\DefaultIcon=%SystemRoot%\System32\imageres.dll,-102
To undo, you can read the assoc /? or ftype /? information, e.g.:
ftype "No_Extension"=
assoc "No_Extension"\DefaultIcon=
assoc .=
Normal files with an extension can have a program associated however this is not the case with files that don't have an extension. If you double click on one and select an application and check the box to always use that application it is ignored and every time you select a file you have to choose the application.
You can force this using the registry:
- Start the registry editor (regedit.exe)
- Move to HKEY_CLASSES_ROOT
- From the Edit menu select New - Key
- Enter a name of '.' and press Enter (don't type the quotes)
- Select the new '.' key
- Double click the (Default) value
- Change to the HKEY_CLASSES_ROOT used to open, e.g. NOTEPAD for the notepad.exe application NOTEPAD
- Click OK

If you now double click on a file with no extension it will open with the application selected.
To check what an existing application used look at its entry under HKEY_CLASSES_ROOT, e.g. HKEY_CLASSES_ROOT.doc uses Word.Document.8 so if you wanted this as your default editor you would change HKEY_CLASSES_ROOT.(Default) to Word.Document.8.
Any method which avoids the need to edit the registry is as follows:
- Open Explorer - View - Folder Options... - File Types - New Type:
- Description of type: Text (any description, you can type in)
- Associated extension: . (just a period)
- Actions: - new...
- Action: open
- Application used to perform action: c:\winnt\notepad.exe
- Click ok, then ok again
- 19,080
- 24,894
This is an example of .reg file for getting Notepad to open unknown file extensions. Create a new text file with an extension of .reg, cut and paste this into it, then double click to run and it'll put it into the registry.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Unknown\shell]
@="notepad"
[HKEY_CLASSES_ROOT\Unknown\shell\notepad]
@="Open with Notepad"
[HKEY_CLASSES_ROOT\Unknown\shell\notepad\command]
@="C:\\WINDOWS\\NOTEPAD.EXE %1"
- 1,003
Can't believe nobody has said this yet. You don't need to provide a path to your text editor like the accepted answer says.
Just run the following in an admin command prompt:
assoc .=txtfile
- 276
For those of you on Windows 11 looking to use Notepadd++, this worked fine. Open an administrator command prompt and paste the following:
assoc .="No Extension"
ftype "No Extension"=^"^%ProgramFiles^%\Notepad++\notepad++.exe^" "%1"
assoc "No Extension"\DefaultIcon=%SystemRoot%\System32\imageres.dll,-102
Note: This is for the x64 version, hence 'Program Files' and not 'Program Files (x86)'
This is very helpful for Dockerfiles.
- 81
- 1
- 1
Most of these solutions didn't work for me on Windows 8.1. I got it working by doing the following (this should work for Windows 7 and Windows 10 as well):
Follow hasnj's solution: First open an elevated command window and type
assoc .="No Extension" ftype "No Extension"="C:\path\to\my editor.exe" "%1"Open regedit and navigate to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.Right click and add a new key called
UserChoiceif it doesn't already exist.In the new UserChoice key, right click and create a new String Value called
Progid. Set its value to "No Extension" (without the double quotes).
- 310
You can also use NirSoft FileTypesManager:
FileTypesMan is an alternative to the 'File Types' tab in the 'Folder Options' of Windows.
FileTypesMan also allows you to easily edit the properties and flags of each file type, as well as it allows you to add, edit, and remove actions in a file type.
Pauk's answer didn't work for me, I had to use instead:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT.] @="No Extension"
[HKEY_CLASSES_ROOT\No Extension]
[HKEY_CLASSES_ROOT\No Extension\Shell]
[HKEY_CLASSES_ROOT\No Extension\Shell\Open]
[HKEY_CLASSES_ROOT\No Extension\Shell\Open\Command] @="C:\\pathtoexe\\yourexe.exe %1"
Note the double backslashes on the exe path.
- 275
The other answers are a bit outdated. Here is a link to one that works for Windows 7:
Shell Extensions for File Names with No File Extension
Shell extensions for file names with no file extension can be registered under the following:
[HKEY_CLASSES_ROOT\.] For example, to associate a program (for example, Notepad.exe) to open all files with no extension, use the following registry keys: [HKEY_CLASSES_ROOT\.] @="" [HKEY_CLASSES_ROOT\.\shell] [HKEY_CLASSES_ROOT\.\shell\open] [HKEY_CLASSES_ROOT\.\shell\open\command] @="<path to notepad.exe> %1" Here is an alternative method: [HKEY_CLASSES_ROOT\.] @="NoExtFile" [HKEY_CLASSES_ROOT\NoExtFile] [HKEY_CLASSES_ROOT\NoExtFile\shell] [HKEY_CLASSES_ROOT\NoExtFile\shell\open] [HKEY_CLASSES_ROOT\NoExtFile\shell\open\command] @="<path to notepad.exe> %1"
Using PowerShell:
This is for Notepad++
Admin required
No reboot needed
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOTNew-Item -Path "HKCR:\Unknown\shell" -Name "Notepad++" New-Item -Path "HKCR:\Unknown\shell\Notepad++" -Name "Command"
New-ItemProperty -Path HKCR:\Unknown\shell\ -Name "(Default)" -Value "Notepad++" New-ItemProperty -Path HKCR:\Unknown\shell\Notepad++\ -Name "(Default)" -Value "Open with Notepad++" New-ItemProperty -Path HKCR:\Unknown\shell\Notepad++\command\ -Name "(Default)" -Value "C:\APPS\Notepad++\notepad++.exe %1"
- 624
I have a problem opening PDF files in IE9, yes IE9 (needed for old program). The PDF files are generated by a Javascript and thrown back at the browser as application/pdf content type, which is good, but filename "none", which is bad. IE8 allows you to choose Save, Cancel and Open and understands the MimeType. for some reason, IE9 does not. So you have to choose every time to open it with PDF reader.
My solution: using this post I have made a file association for the file without extension. first I mapped it to Acrobat Reader, which works fine but is limiting the possibilities for opening a file without an extension. So, I chose Internet Explorer as my default viewer for files without extension. This way, if IE can open it or knows a plugin or other association it will work.
I tested this with the files "none1" and "none2" on my desktop. "none1" is text file that says "hello world". "none2" is a pdf file.
Here's my .reg file:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.]
@="htmlfile"
[HKEY_CLASSES_ROOT\.\PersistentHandler]
@="{eec97550-47a9-11cf-b952-00aa0051fe20}"
-- See screenshot