SEARCH

How-To Geek

Keyboard Ninja: Toggle Hidden Files with a Shortcut Key in Windows

We’ve written a very long time ago about how to toggle hidden files in Ubuntu with a simple shortcut key. But what about keyboard ninjas using Windows instead? After doing some research, I’ve got a simple downloadable solution for you.

What I’ve done is throw together a very simple application that runs in the background and assigns the hotkey Win+H to toggle hidden files. There’s no user interface to keep it from wasting memory, but you can always customize it using the AutoHotkey script provided below instead.

Note: This application was based on an AutoHotkey script created by Lifehacker commenter turnersd, fully credited below.

Toggle Hidden Files

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

image

And presto! You’ll immediately see any hidden files in that folder, or any folders that are open.

image 

Hit the same hotkey sequence again, and the hidden folders will disappear again. Very useful!

Installing the Hotkey

In order to install this and set it up to run at startup, you’ll need to save and extract the downloadable file, and then create a shortcut in your startup group, which you can easily access by typing the following into the location bar:

shell:startup

You could even just copy the executable in… but either way, once you’ve done that, you can double-click on it to start it.

image

Note that there’s no UI for this application, it runs completely in the background to limit memory usage as much as possible.

Killing the Process

Because there’s no UI, if you want to stop the application from running, you’ll need to either reboot… or use the much simpler method of opening Task Manager, finding the ToggleHiddenFiles.exe process and killing it.

image

Using the AutoHotkey Script Instead

The method for creating the hotkey isn’t something that I can take credit for… the credit should be fully given to Lifehacker commenter turnersd in this article about toggling hidden files with a shortcut.

Here’s the source code, which you can copy into an AutoHotkey script file:

; WINDOWS KEY + H TOGGLES HIDDEN FILES
#h::
RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
If HiddenFiles_Status = 2 
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
Else 
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
WinGetClass, eh_Class,A
If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA")
send, {F5}
Else PostMessage, 0x111, 28931,,, A
Return

If you have problems with this source, you can also grab it from the textsnip site.

Downloadable Application

Just remember to extract this file and save it somewhere where it won’t be deleted later. I usually create a folder under my user directory for applications and save them there.

Download ToggleHiddenFiles 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 11/4/08

Comments (41)

  1. milnerw

    My fellow Geek,

    I have been using a shortcut similiar to the one you just described. the only real difference is it does not contain a hotkey. I can’t remember where exactly I found it (it may have been on the ObjectDock website). It is just an executable that you create a shortcut for. when you click on it, it switches back and forth between hidden and unhidden. I have also included the icon i use for my shortcut.

    I’m not sure if this helps you our or not but here it is anyway.

    Download Link
    http://gtswebhosting.com/share/Toggle_Hidden_Files.rar

  2. Kevin Luechtefeld

    Is there any way to do this in Windows XP?

  3. The Geek

    @Kevin

    It should work fine in any version of Windows.

  4. GTD Wannabe

    There’s some kind of error in your ahk script, but the version I got from the link works perfectly. In WinXP.

  5. hansbkk

    Yes, Unicode characters mess things up if you copy and paste from here, but the textsnip service is great – thanks for that too!

    Works fine in XP.

    If you’re running normal AHK mode, you can launch the .AHK file however you usually do, then right-click on the toolbar icon to exit the script.

  6. llamaman

    Now if there were only a way to show hidden files with a hotkey in programs (i.e. Microsoft Access).

  7. Penny

    This works great for some hidden files, but I still can’t show/toggle hidden system files using it. Can the program be altered to do that?

  8. amkeew

    This works great in my XP Pro. Thanks.

    Just became a member.

    amk

  9. amkeew

    @ The Geek

    Is there anyway this can automatically start up with the windows boot ? Now, I have to enable it everytime I boot from the task bar where I have put it.

    amk

  10. amkeew

    Never mind. I copied the shortcut to the startup folder and it automatically boots along with the windows boot.

    Thanks The Geek. This is cool stuff and very cool site.

  11. Intamin

    How’d you create this executable?

    I want to do the same for file extensions…to show and hide them, but I don’t know where to begin.

    Also, I’d like to change the hotkey for hidden files but still be able to use the exe and not have to bother with a vbs all the time.

    Any suggestions? Thanks.

  12. David Simisky

    Is there an extremely simple way to organize my folders & files? Like maybe put them all on one page & list them alpabetically?

    Any heip would surely be appreciated.
    My OS: Windows Home Premium SP1x64

    Thank you,

    David M. Simisky

  13. Aaron

    Great tip. I have been looking for something like this. The only problem is that I use xplorer2 instead of Windows Explorer. Can the script be rewritten to be generally applicable to all file managers?

  14. hyph

    your a savage dude. ultra useful for a kid guarantee nobody is findin stuff “)> 420

  15. Matteo

    You can try using Toggle Show Hidden Files (free open-source):

    https://sourceforge.net/projects/showhiddenfiles/

    It doesn’t require installation and does not run in background. You configure it and it creates the proper shortcuts.
    It can also hide system files.

  16. Wyatt

    FANTASTIC. perfect, simple, and easy. love it.

  17. miss blue

    Absolutely brilliant. My work PC resets my hidden files every time I reboot and I spend a lot of time working on files on the (hidden) company intranet. You’re saving me 15 seconds of irritation a day which I can now spend being a calmer administrator all round. I thank you and my harassed IT team thanks you :)

  18. Eric

    well done! works perfectly!

  19. Chris

    Let me just say — this is a wonderful little app. THANK YOU so much!

  20. Sindisil

    Thanks so much for this!

  21. Tim
  22. Kenneth Niebling

    This works great in Windows 7 x 64 bit. Just download the file
    … unzip the .exe application… run the file or put it in your startup
    directory. Windows + ‘h’ will toggle the folder view to show hidden
    files. The application takes up 1.7 Kb in memory – not much to
    worry about for such a USEFUL utility.

    The .reg files that change the hidden file option require you to
    restart your computer in order to ‘take’ the new registry settings.
    This is inconvenient!!!

    I am looking for an application that will refresh the registry settings
    while logged on. I you have such an app pls let me know.
    KEN (ken.niebling@yahoo.com)

  23. Win

    I copied and pasted the script to Autohotkey and it’s not working – it’s not toggling. I’m on Windows 7 Home Prem x64.

    Thanks

  24. Win

    Never mind. Forgot to reload script. Works great.

    Cheers,

  25. esial

    Finally.
    I was looking for something like this for a while now.
    Works great.
    Thnx!

  26. Jazzy

    works great with AHK on a Windows 7 64-bit Home Premium OS. For whatever reason I find I have to hit my configured hotkey (#^h) a couple of times before it responds properly. I just copied code a few minutes ago so will eventually figure this out later. Thank you to person who sacraficed their time to help us out.

  27. Miroslav

    THANK YOU VERY MYCH ! ! ! :P :))))))) :*************** :DD

  28. Joe

    May I ask how you got the exe file to run in the background without showing a tray icon? My attempt at writing a similar script causes the autohotkey icon to appear at startup.

  29. Jon

    Great utility, thanks! Could it be made to also toggle show protected OS files!

  30. Jon

    That should have been a question mark at the end of that previous post. :)

  31. Dave

    This shortcut is great!

  32. kiwichick

    This is awesome but I agree with Jon. Could it please be made to also toggle protected system files?? That would be great!!!!!

  33. Chintan Ganatra

    You rock man!!! Awesome script!

  34. crackoar

    “TASKKILL /F /T /IM ToggleHiddenFiles.exe”

    Just paste that in a .txt file (without ” “), save it, and change the extention to .bat
    now you dont have to go into the task manager to kill the ToggleHiddenFiles.exe
    if thats what you use.

  35. Dan Smith

    Thanks, this works great, and is a good idea. I wrapped the code in this If block, to have it only work if Windows Explorer is the active window:

    IfWinActive, ahk_class CabinetWClass
    {
    RegRead, Hidden…


    Return
    }
    Return

    (not sure if both those Return’s are necessary, but I have em in mine and it works)

  36. Dan Smith

    Here is another version that uses a TrayTip to tell you if it is hiding or showing hidden files.

    ; WINDOWS KEY + H TOGGLES HIDDEN FILES
    #h::
    IfWinActive, ahk_class CabinetWClass
    {
    RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
    If HiddenFiles_Status = 2
    {
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
    TrayTip, Hidden Files, Show, , 1
    SetTimer, RemoveTrayTip, 3000
    }
    Else
    {
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
    WinGetClass, eh_Class,A
    TrayTip, Hidden Files, Hide, , 1
    SetTimer, RemoveTrayTip, 3000
    }
    If (eh_Class = “#32770″ OR A_OSVersion = “WIN_VISTA”)
    send, {F5}
    Else PostMessage, 0×111, 28931,,, A
    }
    return

  37. Dan Smith

    I forgot the RemoveTrayTip function. Add this after the code in my last post.

    RemoveTrayTip:
    SetTimer, RemoveTrayTip, Off
    TrayTip
    return

  38. Dan Smith

    Sorry for so many posts here. I just noticed an error in the code of my 2nd to last post. (admin, feel free to delete my last 3 posts)

    Here is a version that shows the status via TrayTip, only works if Window Explorer is the active window, and shows/hides System Files…

    ; WINDOWS KEY + H TOGGLES HIDDEN FILES
    #IfWinActive, ahk_class CabinetWClass
    #h::
    RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
    If HiddenFiles_Status = 2
    {
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowSuperHidden, 1
    TrayTip, Hidden Files, Show, , 1
    SetTimer, RemoveTrayTip, 3000
    }
    Else
    {
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
    RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowSuperHidden, 0
    TrayTip, Hidden Files, Hide, , 1
    SetTimer, RemoveTrayTip, 3000
    }
    WinGetClass, eh_Class,A
    If (eh_Class = “#32770″ OR A_OSVersion = “WIN_VISTA”)
    send, {F5}
    Else PostMessage, 0×111, 28931,,, A
    return
    #IfWinActive

    RemoveTrayTip:
    SetTimer, RemoveTrayTip, Off
    TrayTip
    return

  39. Earthling

    Thanks man. this is really great.

  40. Nuwan

    Thanks Bro..! , very useful application, pure & simple…

  41. Saladdin

    Thanks, I like and features like these should be built into windows already.

Enter Your Email Here to Get Access for Free:

Go check your email!