Windows does not use the dot-file convention for hidden files. However, many Windows applications (mostly opensource/cross-platform) use files and folders with this convention. How can I make Windows Explorer automatically hide these dot-files?


ATTRIB +H /s /d C:\.* is the command to hide anything, directories included that start with a dot

This won't list the files (as stated below), but will hit every file it can access, and apply the Hidden attribute.

Once this is done, you can make sure that the Folder Options are set to hide hidden files. Click on Start, type folder options and press Enter. Click on the View tab, then choose Don't show hidden files, folders, or drives under Files and Folders \ Hidden files and folders. Hit Apply, then OK (or just OK).

  • 1
    only thing that sucks about this... it doesn't output anything. No way to verify which files it touched. =( – Mechaflash Dec 14 '11 at 19:38
  • 5
    another thing that sucks, is that it you have to do it manually every time you get such files. – Justinas Dūdėnas Nov 29 '14 at 16:07
  • 3
    my Users folder is ever so grateful – Mikey Feb 19 '16 at 16:06
  • 2
    Beware: on Windows files CreateFile calls with CREATE_ALWAYS but without explicitly specified FILE_ATTRIBUTE_HIDDEN flag, operations will fail on hidden files. Some tools are aware about this, but with some (sorry, don't remember exactly what I had issues with) this happens silently and the only noticeable problem is that configs or logs are somehow not updated. Check e.g. here for more details: stackoverflow.com/a/13215998/116546 – drdaeman Dec 29 '17 at 17:42


In Windows Explorer

  1. Right click on the .folder you want to hide;
  2. Click properties, then click on the general tab;
  3. Click on hidden.


PS Only checked on Windows 7 Professional. PPS I noticed your question asked for doing this automatically. Clearly this won't cut it, but maybe readers find it useful.


Windows will hide files with the hidden or system flag. Or files may be hidden using ACL. Windows does not hide files based on filename.

To explicitly have Windows to hide files by filename, you'll need to explicitly create the feature. Either a file system driver (it use to be common for viruses to have this "feature") or a shell extension hack will work in this case.

On a side note, you can fake the feature by turning off "view file extensions" under Folder Options, since, to Explorer, a file that starts with a dot is a file with an extension, but no name.

  • 2
    Windows does not have an option to hide all file extensions. This is the only related option: Folder Options > View > [ ] Hide extensions for known file types. – iglvzx Dec 4 '11 at 7:20
  • Like I said, not a real feature. – surfasb Dec 4 '11 at 7:34
  • Hiding extensions for known file types doesn't seem to actually hide such files though. I still see them listed in explorer, just with a blank name. It also doesn't appear to affect folders at all (eg. ".txt" is still displayed in full). Windows 7. – sqweek May 24 '16 at 4:16

It is possible in C#, using System.IO.FileSystemWatcher. Code would be something like this. Just compile it and place it in the Start Up folder. But this code doesnt hide already existing files. So run first the code from Luke, and than this code. You need the System.IO and System.Security.Permissions

    [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    public static void Run()
        FileSystemWatcher watcher = new FileSystemWatcher();
        watcher.Path = "C:\\";
        watcher.IncludeSubdirectories = true;
        watcher.Filter = "*.*";
        watcher.Renamed += new RenamedEventHandler(OnRenamed);
        watcher.Created += new FileSystemEventHandler(watcher_Created);
        watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
        watcher.EnableRaisingEvents = true;
        while (true) ;
    static void Check(string filename)
        string name = Path.GetFileName(filename);
        if (name.StartsWith(".") && !File.GetAttributes(filename).HasFlag(FileAttributes.Hidden))
            File.SetAttributes(filename, File.GetAttributes(filename) | FileAttributes.Hidden);
    static void watcher_Created(object sender, FileSystemEventArgs e)
    private static void OnRenamed(object source, RenamedEventArgs e)

I don't think there's a way to make it happen automatically, but you could try using the ATTRIB command to hide those files:


Then make sure that you've configured Explorer to not show hidden files.


I wrote this powershell function which I placed in my powershell profile file so that whenever I start a new powershell session, the function is readily available.

function hide-dots {

    if ($path -eq ".") {
        $cwd = (Get-Location).Path.Substring((Get-Location).Path.LastIndexOf("\") + 1)
        echo "Searching for files in $($cwd) ..."
    else {
        echo "Searching for files in $($path) ..."

    $Activity = "Hidding Dot Files."
    $isDotFile = {$_.name -match "^\..*"}
    $isNotHidden = {$_.attributes -match 'Hidden' -eq $false}
    $dotFileCount = 0
    $markedCount = 0

    Get-ChildItem $path -Recurse -Force -ErrorAction SilentlyContinue |
        where $isDotFile |
        where $isNotHidden |
        foreach {
            $path = $_.FullName

            Write-Progress `
                -Activity $Activity `
                -Status "Found $($dotFileCount) dot files."

            if ([System.IO.File]::Exists($path)) {
                Set-ItemProperty `
                    -name Attributes `
                    -value ([System.IO.FileAttributes]::Hidden) `
                    -path $path


    echo "Marked $($markedCount) dot file(s) as hidden."

If not given a specified path it will recursively search for all dot files in the current directory and set the attribute of the file or folder as hidden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.