Click here for Low cost website hosting!

IP Address Lookup
IP Address

Microsoft Windows Tips And Tricks!


Listing, Setting And Deleting Hidden Files From The Command Prompt In Windows Xp, 2003, Vista, 7 And 8

In Windows, files and folders can have a special attribute called the hidden attribute. By setting this attribute, you can hide files from being displayed in explorer or the command prompt. This example explains how to list, add/remove this attribute and delete hidden files in the windows command line.

First Open an Administrator/Eleveted command prompt.
To get the list of hidden files from a directory you can run the below command.
dir Path_to_Directory /A:H /B
The letter A tells windows this is a file type attribute, the H=hidden attribute.
The letter B option is optional and tells windows to leave off the information about the drive and free space etc, and just list the files.
Here is an actual hidden file listing.

List Hidden Files From CMD Prompt

To tell if there is any hidden files present in a directory run the following command from the command prompt.
attrib Path_to_directory\*.*
If you see the Letter H next to a file name that means its a hidden file.
You can also add the /S to the above commands to list sub-directories as well.
Example of above command also notice all the H's next to each file so marked as hidden.

List Hidden Files Attrib CMD Prompt

You may have once marked or unmarked files as hidden in the Windows GUI as shown below. This is done in explorer by right clicking a file then selecting properties and checking or unchecking the hidden check box.

Win GUI Right Click File Properties Hide

You can also hide and unhide files from the command prompt with this command:
attrib +H or -H path_to_file
To do the same to many files at the same time:
attrib +H or -H path_to_files\*.*
Again you can add the /S if you wish to include sub-directories.
Below the command shown at the command prompt:

Remove Hidden Attrib From Files CMD Prompt

After the command was run above you can see the directory listing shows the files are no longer hidden.

Now to delete a hidden file or files from the command prompt run the following command:
del path_to_file /A:H for one file, for many files: del path_to_files\*.* /A:H.
You can also again add the /S option to delete hidden files in sub-directories too.
The command as run from the command prompt:

Delete Hidden Files From CMD Prompt

Notice when the directory is listed with both the dir and attrib command it is now empty since all the files in it were hidden.

Thanks for visiting

Return to Index Page

Valid HTML 4.01 Transitional
Copyright 2018 CSN All Rights Reserved