Setting the Default Unknown Action to Textpad in Windows 7

Usage tips, posted by users. No questions here please.

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
tasbury
Posts: 9
Joined: Fri Feb 03, 2006 7:21 pm
Location: Bozeman, MT

Setting the Default Unknown Action to Textpad in Windows 7

Post by tasbury »

For a long time (since Windows 98), I have used Textpad on a mixed Windows and unix network. I like to be able to double-click on any old file type and at least get it to open with Textpad. To do that, I have set the default action for unknown file types to Textpad. The out-of-the-box action for Windows in this case is to show the "Open with" dialog, and that's what I will show how to change.

This involves poking around in the registry. One should probably back up the registry before messing with this, but I never found a great way, and so don't. Your mileage may vary.

So, get into regedit.exe.

The HKCR\Unknown\shell\(Default) value is probably set to "openas". Delete the (Default) value "openas" and leave (Default) empty.

Still under HKCR\Unknown\shell\, define a tag "open", and set its default to
(Default) = Open with Textpad

Under the new HKCR\Unknown\shell\open\ tag, define a tag named "command", and set its
(Default) = \path\to\Textpad "%1"
where, of course, "\path\to\Textpad" is going to be something along the lines of
C:\Program Files (x86)\TextPad 5\TextPad.exe

unquoted, and you really do want the quotes around the "%1". Now, under HKCR\Unknown\shell\openas\, I set the default to
(Default) = Choose...

since it will show the "Open with" choose-a-program dialog.

Now, a file not set to open with any other program will open with Textpad when double-clicked, and will show "Open with Textpad" as the top, old-faced, default option.

I realize one can always right-click and choose "Textpad" from the context menu, but I do this sort of thing too often to want to mess with that.

Untyped files (no extension) opened across the LAN will get an Eek-Scary-Internet dialog from Windows 7. I would love to find some way to make that go away without disabling all of those sorts of file checks, but I haven't. Right-clicking the "Textpad" context-menu entry does not get Eek Scary Internet. Double-clicking or right-clicking the (bold top entry) "Open with Textpad" does, as does Right-clicking "Choose...". But then, opening untyped files across the network does anyway, even without these changes.

Something like this has worked on every version of Windows I've tried it on: Windows 98, NT2000, XP, and Windows 7. I started out making mods to HKCR\* as well as HKCR\Unknown, but on Win 7, at least, it's not necessary. I can go back to my notes on former Windows versions if anyone feels the need.
robertcollier4
Posts: 22
Joined: Tue Jan 31, 2012 5:38 am

Post by robertcollier4 »

This will do it properly with passing the filename through dde - so that Textpad will open the file in the existing window instead of launching a new instance.

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Unknown\shell]
@="Textpad"

[HKEY_CLASSES_ROOT\Unknown\shell\Textpad] 
@="&Textpad" 

[HKEY_CLASSES_ROOT\Unknown\shell\Textpad\command]
@="\"C:\\Program Files\\TextPad 6\\TextPad.exe\" -s"

[HKEY_CLASSES_ROOT\Unknown\shell\Textpad\ddeexec]
@="[open(\"%1\")]"

[HKEY_CLASSES_ROOT\Unknown\shell\Textpad\ddeexec\application]
@="TextPad.6"

[HKEY_CLASSES_ROOT\Unknown\shell\Textpad\ddeexec\topic]
@="system"
Post Reply