There are two methods of hiding files in MS-DOS or the Windows command line without installing any additional software on the computer.
Hide using the attrib command
The first method uses the attrib command as seen below.
attrib +h c:\autoexec.bat
This command hides your autoexec.bat file so a standard user browsing your hard drive would not be able to see the file. To make the file unhidden, use -h instead of the +h so the line would look like the example below.
attrib -h c:\autoexec.bat
Although the file is hidden, someone could still type edit c:\autoexec.bat and edit the file, or if someone typed attrib it lists all files and their attributes.
- See our attrib command page for full information on this command and other examples.
Hide using ASCII characters
The other method uses ASCII characters when creating a directory or renaming it and prevents anyone using an early version of Windows and MS-DOS from accessing the directory. Below are the steps required for creating a directory with these characters.
- Type md (hold down Alt and type 987 while continuing to hold Alt, once typed in let go of Alt and a solid block appears).
- Press Enter to create the directory.
To get into this directory, type cd followed by a space, and hold Alt while typing 987 to get the block. When pressing Enter, you would then be able to get into the directory.
I can’t remember what characters I typed. How do I delete the directory now?
See the ASCII dictionary definition that lists a complete listing of ASCII characters or use the “?” wildcard where the ASCII character is.
You can substitute 987, for the dec (decimal) number of any ASCII character.
Windows 3.x and Windows 95 cannot access these directories, and must be accessed through DOS. However, Windows 98 and later has the capability of opening these directories from within Windows. Therefore, if you are using this method for privacy or security, your procedure could be bypassed.
Related information
- How to hide a file or folder in Windows.
- How to see hidden files in MS-DOS and the Command Prompt.
- How to view hidden files and folders in Windows.
- See the hidden files dictionary definition for further information.
- MS-DOS and Windows command line help and support.