12

I have successfully created a ShellNew command so that I can create a new blank file with no file extension, with the reg file being:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.]

[HKEY_CLASSES_ROOT\.]
@="emptyFile"

[HKEY_CLASSES_ROOT\.\ShellNew]
"NullFile"=""
@="Empty File"
"ItemName"=""

[HKEY_CLASSES_ROOT\.\ShellNew\Config]
"NoExtension"=""

[-HKEY_CLASSES_ROOT\emptyFile]

[HKEY_CLASSES_ROOT\emptyFile]
@="Empty File"

[HKEY_CLASSES_ROOT\emptyFile\DefaultIcon]
@="%SystemRoot%\\system32\\imageres.dll,2"

This works fantastic, creating the file just how I want it to, but the icon displayed in the ShellNew window is the icon for the System Partition [below]; how can I change this icon to match the DefaultIcon I am providing for the file type itself?
Screenshot1

  • I have tried making an "Icon" String Value like what I had to do for the Unity and Sublime Text menu items, but that did not work no matter where I put it
4
  • I can replicate. Trying to figure out if there's a way to fix it...
    – Karan
    May 27, 2015 at 17:25
  • I suppose that you have not yet found a solution? I am thinking that there must be something in the registry stating that since it has no associated file type, it assumes it is a drive?
    – GodsBane
    May 28, 2015 at 12:43
  • Looks like it, and if I had figured it out I would have posted an answer of course.
    – Karan
    May 28, 2015 at 18:18
  • I can not seem to replicate this. Feb 19, 2016 at 23:09

4 Answers 4

7
+50

Try this, which works like magic, with the only change being I added an IconPath at the .ext level (file type associations are amazing stuff!):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.]
@="emptyFile"

[HKEY_CLASSES_ROOT\.\ShellNew]
"NullFile"=""
@="Empty File"
"ItemName"=""
"IconPath"="C:\\windows\\system32\\imageres.dll,2"

[HKEY_CLASSES_ROOT\.\ShellNew\Config]
"NoExtension"=""

[-HKEY_CLASSES_ROOT\emptyFile]

[HKEY_CLASSES_ROOT\emptyFile]
@="Empty File"

[HKEY_CLASSES_ROOT\emptyFile\DefaultIcon]
@="%SystemRoot%\\system32\\imageres.dll,2"
3
  • Another thing is, for the the ProgID's DefaultIcon you've set an expandable string, which really should have been of type REG_EXPAND_SZ instead of REG_SZ. Regardless, ShellNew doesn't seem to use the icon defined there.
    – w32sh
    Feb 21, 2016 at 14:31
  • Yep, that does it. Well done!
    – Ben N
    Feb 21, 2016 at 16:44
  • Wow, ~9 months old, and such a simple fix. Awesome job!
    – GodsBane
    Feb 21, 2016 at 19:41
0

Arent you supposed to use "imageres.dll,3" because its 3rd icon in imageres.dll?

You can try Default Programs Editor application, open program, click icons, find file type, click next, choose icon from imageres, and save as .REG file, then check whats inside that .reg.

2
  • You can't use Default Programs Editor for this because the file that it makes has no extension.
    – GodsBane
    Jul 27, 2015 at 15:44
  • @orion310591: The index starts from 0. So it's technically the 2nd icon.
    – w32sh
    Feb 21, 2016 at 14:27
0

For whatever reason, this uses the same default icon as your C drive.

You can see this for yourself by creating the following key, if it doesn't already exist:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\C\DefaultIcon

And setting the (Default) to:

%SystemRoot%\\system32\\imageres.dll,2

enter image description here

enter image description here

I'm afraid I can't answer exactly why this behaviour occurs. There's actually another thread here that manages to change the icon with a different registry key though.

-1

If you are able to find the "Empty File" type in the FileTypesMan tool you might be able to change the Default Icon there.

FileTypesMan: http://www.nirsoft.net/utils/file_types_manager.html

3
  • I am under the impression that those kind of tools just do what the OP did manually, but I'll try it when I get time.
    – Ben N
    Feb 16, 2016 at 22:57
  • @BenN I guess you're correct - I assumed OP just wanted to 'fix' it but I guess they want to find a regedit solution.
    – Stian Lund
    Feb 17, 2016 at 12:12
  • 1
    Somewhere windows must be overriding the icon because FileTypesMan sees the correct icon, displays it there, and yet the ShellNew still displays the OS drive icon. This still is the case in Windows 10, even though I doubted that would have changed.
    – GodsBane
    Feb 17, 2016 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .