DEV Community

Cover image for How to show hidden files on Microsoft Windows
Habdul Hazeez
Habdul Hazeez

Posted on • Updated on

How to show hidden files on Microsoft Windows

Introduction

There are certain cases when you need to show hidden files and directories in Microsoft Windows for reasons best known to you. In this article you'll learn how to do that using Windows Explorer and Command line.

Via Windows Explorer

This option is easier compared to the command line option (discussed later). Kindly perform the following steps:

Step 1

Press and hold the following key combinations Windows Key + R on your keyboard, this will invoke the Windows Run dialog box.

Windows "Run" dialog box

Step 2

Type control folders in the box

Windows "Run" dialog box with text "control folders"

Step 3

Hit OK, and it will display the following box:

Windows "control folders" box

Step 4

Navigate to the second tab which is the View tab.

Step 5

Click on Show hidden files, folders, and drives and click the Apply button then OK button.

Windows "control folders" View tab

Step 6

That's it. When you do this all files and folders on the system will show.

When you intend to hide all the files, click on Don't show hidden files, folders, and drives and click the Apply button then OK button.

Via Command line

You have to be specific here because it's not advisable to show all hidden files on the system via the command line (unless you are hunting for something).

When you show files via the command line, and you want to hide them back you might have to click on each file and folder and set its attributes to hidden, this can be inconvenient, and it could take lots of your time therefore, it's best to navigate to folder or drive that you would like to show files therein.

Perform the following steps:

  1. Navigate to a folder or drive via Windows Explorer.
  2. Press and hold down the Shift key, and Right-click on an empty space. The context menu will pop up, among its options is Open command window here. Click on it, this will open the command prompt.
  3. Type the following: attrib -h -s -a /s /d *.*. It might take a while for it to complete depending on the number of files hidden in the folder. When it's done, the cursor will move to receive another set of commands.

Explanation of the command

The attrib command is used to manipulate the attributes of files and folders on a Windows system, the remaining part of the command are called flags, these flags are explained in the table below:

Flag Explanation
-h Hidden files
-s System files
-a If it's an archive
/s Search the path name including all subfolders
/d Process folders as well
*.* All files irrespective of their extension

Advantages of the command line option

The command line option is quite useful if you have a USB drive that's infected with Malware. When Some malware infects a USB drive, it will hide all the files on the drive. Then you can follow the above detailed steps to show files on the USB drive.

Credits

Cover photo by Tadas Sar on Unsplash.

Updates

  • Added series name on 2nd February 2021.

Top comments (0)