SEARCH

How-To Geek

Keyboard Ninja: Toggle File Extension Display With a Shortcut Key in Windows

Have you ever wanted to be able to easily toggle the visibility of file extensions? We’ve shown you how to toggle hidden files before, and now we’ve come up with a similar solution for file extensions.

If hotkeys are your game, be sure and check out our 21 keyboard shortcut articles.

Toggle File Extensions

Once you’ve downloaded and run the application, all you need to do is hit the Win+Y shortcut key while you have any folder open:

image

And you’ll immediately see the file extensions, or won’t see them – the point is that it will toggle between the two settings.

image

Using the same hotkey sequence you can bring the file extensions back.

Installing the Hotkey

To make this run at startup, you have to save and extract the downloadable file, and then create a shortcut in your startup folder, which can be accessed by putting the following into the location bar:

shell:startup

You’ll notice the ToggleFileExt item that I added into the startup folder.

image

There’s no UI for this application, and it’ll run completely in the background with fairly low memory usage.

image 

Using the AutoHotkey Version

If you are already an AutoHotkey user and would like to just add this to your current script, the full source code is here:

; WINDOWS KEY + Y TOGGLES FILE EXTENSIONS

#y::
RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt
If HiddenFiles_Status = 1
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0
Else
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1
WinGetClass, eh_Class,A
If (eh_Class = “#32770″ OR A_OSVersion = “WIN_VISTA”)
send, {F5}
Else PostMessage, 0×111, 28931,,, A
Return

Note: If the script doesn’t work for you, you can grab a text version here.

This isn’t the type of utility that I would end up using all the time, but it works great as part of my regular AutoHotkey toolkit.

Download ToggleFileExt Hotkey Application

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 03/18/09

Comments (10)

  1. ville

    AHK script wont work, whines about unicode or something. Can you put it to textsnip (that worked for the previous script)?

  2. ville

    I put it to textsnap to view it as a plain text, but the script still gives this error: Error at line 55. Line Text: (eh_Class = “#32770″ OR A_OSVERSION= “WIN_VISTA”) Error: Missing “)”

    What to do?

  3. The Geek

    @ville:

    I uploaded a text version, linked in the article now.

  4. oddacorn

    The quote after the #32770 is a unicode closing quote. I was using PSPad to edit it and couldn’t figure out why it continued to highlight “OR A_OSVERSION=” as quoted text until I got the error. That’s when I figured it out. If you paste the text into your editor and then delete and retype that quote, you’ll have a script that doesn’t blow up, though it still won’t actually work.

    The second more insidious problem is that the “x” in “PostMessage, 0×111″ is actually a multiplication symbol. It doesn’t generate an AutoHotkey error, but it also doesn’t refresh Windows Explorer properly. Change that to an honest-to-goodness lowercase letter “x”, and you’ll actually be able to run the code and get what you want. By the way, I find [Win] + [.] to be an intuitive shortcut for this piece of code.

    Geek, I’d recommend updating the HTML to fix these little glitches and then folks can cut and paste that code. Thanks for another great tweak!

    Todd Corson

  5. The Geek

    @oddacorn:

    Sorry about that, WordPress does awful things with code. Very irritating.

  6. Andy

    It would be useful if it was a Registry addition rather than an auto-startupTSR.

  7. Jennifer

    Thank you, thank you, thank you!

    You fixed something that has been a pet peeve of mine forever, I really appreciate it.

  8. Kenneth Niebling

    When I put this file in my startup file then I have a problem on bootup that indicates that an older version of this script is running…. msgbox. I hit yes or no and then everything is fine after that. I would like to allow the script to execute without this warning. I see that another person has the same kind of problem with another #singleinstance application. You may need to modify the script so that togglehiddenfiles.exe forces a single instance or reloads without a warning. Do you have any solution for this??? (see below)

    Posted: Fri Apr 15, 2005 1:45 pm Post subject: #SingleInstance force problem
    I use
    Code:
    #SingleInstance force
    on the very beginning of my script.
    Still I receive the annoying message when starting another instance:
    Quote:
    An older instance of this script is already running. Replace it with this instance?
    Note: To avoid this message, see #SingleInstance in the help file.

  9. 도진성

    알려주셈

  10. Kenneth

    How do I set #Singleinstance Force

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!