8

I have successfully created a ShellNew command so that I can create a new blank file with no file extension. The reg file looks like this:

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 and all. It creates the file just how I want it to, but the Icon displayed in the ShellNew window is the icon for the System Partition like so:

1

How can I change this icon to match the DefaultIcon I am providing for the file type itself? I have tried making an "Icon" String Value like what I had to do for the Unity and Sublime Text menu items, and that did not work no matter where I put it.

  • I can replicate. Trying to figure out if there's a way to fix it... – Karan May 27 '15 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 '15 at 12:43
  • Looks like it, and if I had figured it out I would have posted an answer of course. – Karan May 28 '15 at 18:18
  • I can not seem to replicate this. – Visual Vincent Feb 19 '16 at 23:09
3
+50

Try this, works like magic.

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"

Only change. I added a IconPath at the .ext level. File type associations are amazing stuff!

  • 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 '16 at 14:31
  • Yep, that does it. Well done! – Ben N Feb 21 '16 at 16:44
  • Wow, ~9 months old, and such a simple fix. Awesome job! – GodsBane Feb 21 '16 at 19:41
  • It said the bounty was about to close "in 2 hours". That's when I replied :) – w32sh Feb 22 '16 at 3:57
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.

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

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

  • 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 '16 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 '16 at 12:12
  • 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 '16 at 22:30
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.

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.