1

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.

Kamil
  • 2,686

2 Answers2

2

Or use this:

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"

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...

Ξένη Γήινος
  • 3,902
  • 13
  • 45
  • 84
1

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...

Ξένη Γήινος
  • 3,902
  • 13
  • 45
  • 84