Quick Links

While most of us never need to see or access the hidden files on our Windows systems, others may need to work with them more often. Is there an easy way to toggle back and forth between showing and hiding hidden files? Today's SuperUser Q&A post has the solution to a frustrated reader's problem.

Today's Question & Answer session comes to us courtesy of SuperUser---a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

The Question

SuperUser reader RogUE wants to know how to show or hide Windows hidden files via a command line toggle:

I often need to toggle between showing and hiding the hidden files on my Windows system. I have been doing it the usual way:

  • Click Organize in an Explorer Window
  • Select Folder and Search Options
  • Switch to the View Tab
  • Toggle between Show/Hide Hidden Files

This method is lengthy and I am tired of it. I would like the ability to toggle between showing and hiding them using the Command Line (CMD). Is there a way to set this up for regular files as well as system files?

How do you show or hide Windows hidden files via a command line toggle?

The Answer

SuperUser contributor Steven has the answer for us:

Hidden Files, Folders, or Drives

Add (or overwrite /f) the value Hidden to the registry key:

  • HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

Show

  • reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t REG_DWORD /d 1 /f

Do not Show

  • reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t REG_DWORD /d 2 /f

ToggleHiddenFiles.bat

how-do-you-show-or-hide-windows-hidden-files-via-a-command-line-toggle-01

Checked

  • reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t REG_DWORD /d 0 /f

Unchecked

  • reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t REG_DWORD /d 1 /f

ToggleSystemFiles.bat

how-do-you-show-or-hide-windows-hidden-files-via-a-command-line-toggle-02

Notes

The changes take place immediately. The program reg requires admin privileges, so the batch files must be run as administrator.


Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.