My question is similar to this (very useful, check it out!):

How to set the default program for opening files without an extension in Windows?

but I'm struggling with hidden Linux files. Linux hidden files begin with . and whole filename is interpreted by Windows as filename extension.

I would like to open these files in notepad by default for example. Is this possible in Windows 10?

I'm using 20H2 version.


Or use this:

Windows Registry Editor Version 5.00


@="Open with Notepad"


Save it as a .reg file and put it in registry, if you want to use any other program, just replace notepad in first and second section with the name of the program, and the path to notepad with the full path of the executable in the third section, you have to use double backward slashes;

By default, Windows prompts user to choose a default program for unknown extensions, stored in HKCR\Unknown key, modify it and you can set the default program to all unknown extensions; If the whole filename is extension, and all filenames are unique(in same path), and the filenames are random, then they definitely are unknown extensions;

But it is recommended against using it, I didn't give it as the first answer because it isn't a clever solution; For example, if you use notepad as the default program for all unknown extensions, if .mp3, .dll, .jpeg are unknown, you will see only unintelligible random characters because it isn't the right way to open them; If .rar, .zip, .7z are unknown, well, try open them with notepad and see what happens...

  • I have messed up HKEY_CLASSES_ROOT\*, but it looks like it does the job. Thank you for investigating this!
    – Kamil
    Dec 29 '20 at 0:58
  • What makes this command default for unknown extension? I changed notepad path to notepad++ and renamed shell\notepad to shell\npp key and it stopped working as default (but still appears in context menu).
    – Kamil
    Dec 29 '20 at 1:11
  • I said don't do it and you didn't listen, one program can only open a specific type of files, notepad can only open plain text files, media files aren't encoded in plain text, they aren't text files at all, open compiled files with notepad is dumb, open archive files in notedpad will make notepad unresponsive for a long time and huge RAM space and can potentially crash your system, and you will get nothing, because it isn't designed to open such files, open all unknown extension with one program is insane, no program is designed to do it, you need seperate programs for each extensions... Dec 29 '20 at 1:11
  • I know what will happen when I'll try to open 2GB file in notepad++, don't worry :)
    – Kamil
    Dec 29 '20 at 1:13
  • The command(third section), change path to notepad to path to notepad++:"C:\\Program Files\\Notepad++\\Notepad++.exe" Dec 29 '20 at 1:14

I am afraid Windows doesn't support this natively AFAIK, you will have to create a logic yourself, if the whole filename is interpreted as an extension, then there is no filename without extension, you can use this in PowerShell:

if (-not ([System.IO.Path]::GetFileNameWithoutExtension($File))) {&"$Env:ProgramFiles\Notepad++\Notepad++.exe" $file}

If you can put this or some other logic similar to this in registry somehow, then you can double click on the files to open them with Notepad++(or do assoc and ftype for everyone of them...).

The above script is an if statement, it only executes only if the if condition is true, -not is a logical operator that means "not", in here it means "not exist", [System.IO.Path] is a PowerShell class, GetFileNameWithoutExtension() is a .Net method which does exactly what it says; $File is a variable, the whole block in () is a condition, which means "not exist filename without extension", the block in {} is a command block, $Env is for calling Environment variables, $Env:ProgramFiles equals to %ProgramFiles% in cmd, usually it is "C:\Program Files", the string in "" is the path to Notepad++, & is a call sign, used to invoke the executable at the path, the command block opens the file with Notepad++;

To use it, replace the variable $file with the full path of the file, the path must be enclosed in double quotes, or run: $file="path\to\file" first, if you want to use another program, replace path to Notepad++ with full path of the program, also enclosed in double quotation marks...

  • Thanks for the answer. Can you explain a bit what this PS script does/how it works?
    – Kamil
    Dec 29 '20 at 0:05
  • Thanks. I missread your answer first time and I was wondering where to put this and what calls this scipt. But you wrote that I can put this line in the registry...
    – Kamil
    Dec 29 '20 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.