515

Many programs needs folder names that starts with a dot, like .emacs.d, .gimp-2.2, .jedit etc. How do I create such a folder?

When using the Windows Explorer in Windows 2000 (and other versions), I get an error message saying "You have to enter a filename". The only solution I have come up with, is to open a command prompt (Start > Run > "CMD" > OK) and enter mkdir .mydir.

Why have Microsoft this error message in the Explorer, but not in the command shell? Is there any registry hack out there to fix this, so that I am able to enter the folder name directly in the Explorer?

5
  • 6
    This is an ancient protection built into windows explorer and dates back to the time that only DOS 8.3 filenames were available (Win 3.1) and files with just an extension were not allowed. Microsoft never bothered to remove this from the Explorer, probably because humans using the Explorer should be "protected" from accidentally creating files without a filename (i.e., only extension).
    – Abel
    Nov 2, 2009 at 15:22
  • 14
    See also "How do I rename a file to .htaccess in Windows 7?" at superuser.com/questions/56562/…
    – Arjan
    Nov 2, 2009 at 15:30
  • I encountered a similar problem when creating files. Some files were namedcom4.txt, com1.txt etc and those are reserved names for devices, so it crashed my software.
    – Zimano
    Feb 12, 2020 at 16:00
  • Also, perhaps to somewhat clarify re the good initial comment above: the '8.3' in the comment refers to the naming convention at that time of xxxxxxxx.xxx, or filename.ext, referring to the fact that maximum filename length at that time for those systems was 8 characters,.separated by a dot, and the 3 for the length of extension characters, cf referring to a DOS Version such as DOS 3.1, DOS 3.3, or DOS 5.0 , Thank you :)
    – M H
    Nov 12, 2020 at 4:47

12 Answers 12

713

To create/rename on windows explorer, just rename to .name. - The additional dot at the end is necessary, and will be removed by Windows Explorer.

To create a new file begins with a dot, on command prompt:

echo testing > .name
17
  • 16
    I just tried .name. in Windows (XP) and it did not work; it complained about needing a filename.
    – Synetech
    Jun 24, 2012 at 16:54
  • 68
    Confirmed to work on Windows 7. That's awesome.
    – Joe White
    Jun 30, 2012 at 21:26
  • 52
    Confirmed to work on Windows 8. Jan 24, 2013 at 3:38
  • 11
    Only option to create in XP is thru command prompt. say mkdir .name May 8, 2013 at 18:05
  • 72
    Works on Windows 10 - @Denny where did you find this gold nugget?! May 29, 2015 at 1:52
71

You can create a folder using the Command Prompt with:

mkdir .foldername

You can create a file using command prompt with:

echo.>.filename.extension

39

Good question. There is an easy way to do this from Windows Explorer without using a command prompt or shell. Suppose you want to create a folder called: ".apple"

  1. Create a New Folder from Windows Explorer as you normally would.
  2. When prompted to enter a name, type: ".apple." (notice the dot at the end)

Windows should create a folder called: ".apple"

Please note that I've used this only on Windows 7. I am not sure if other versions of Windows support this.

P.S. Chris Moschini says in a comment that it works in Windows 10.

3
  • 6
    Works in Windows 10. Sep 13, 2017 at 17:52
  • 8
    this was exactly the same as the top voted answer in this question, only 4 years later
    – phuclv
    Jun 15, 2018 at 1:24
  • You have just saved my life, I accidentally rename all folders and files from my Windows User folder and my programs started to fail. Fortunately i was able to reset the names. +1e6 votes up. Jul 26, 2018 at 23:24
14

Use any file browser other than Explorer (Shell). I have tested with WinRAR, 7-Zip ect. For example, open WinRAR, then navigate to your files or folders, click on it, press F2 (rename), put a . at beginning, Done! I have tested with both WinRAR and 7-Zip. You don't need to add to Zip or make a compressed file.

The simpler method I found in other answer, just put a . at the end too.

8

Open a Command Prompt window and enter the following commands:

cd /path/to/the/file
ren file.extension .file.extension

That worked for me.

6

You can do it with powershell cmdlet New-Item.

Open PowerShell console and enter

For File:

New-Item .whatever -type file

For Folder:

New-Item .whatever -type directory
1
4

Total Commander does it in visual manner.

0
2

Use Windows Powershell. Otherwise this is not possible with DOS/Explorer - only method is to create foo.bar and then rename with the explorer window.

With Powershell you can

touch .bak

successfully.

1
  • 1
    this is definitely possible. Did you look at the most voted answer which was posted several months before yours?
    – phuclv
    Jun 15, 2018 at 1:27
2

I couldn't create .bowerrc. So

First, I created bowerrc Then, to a dos prompt I said:

>powershell
PS > ren bowerrc .bowerrc
PS > exit
>
1
  • 1
    you dont even need powershell. just plain old cmd (see other answers) - Powershell definitely works though :)
    – Nick
    Mar 22, 2016 at 6:45
1

My favorite way to do this: I have ConEmu installed and integrated into the Windows context menu. https://stackoverflow.com/questions/21852965/open-in-conemu-right-click-menu-windows-7

When I need to rename a file to one with the dot I choose "ConEmu here" from the context menu, then type:

ren name .name

Can also be used with echo method above.

Benefits:

  • Quick and easy, doesn't take you out of context too much.
  • No need to type D: enter cd D:\\____\\_____\\_______\\____
  • No need to install software you wouldn't otherwise (I like and use ConEmu for various purposes).
0

Just download Anyclient and Fast Folder Rename. Fast folder rename will name a folder .whatever, using the replace feature. Anyclient will upload the folder and show it, even though it operates on a Windows system.

1
-4

Windows (Explorer) does not allow you to create a folder that starts with a dot ('.'). This is for security/exploit reasons. However, it is possible (as you noted) to create the folder manually using the Command Prompt.

So, if your question was how to do it in native Windows Explorer, the answer is no -- You cannot.

3
  • 1
    How do you do it from the command line?
    – Buttons840
    Nov 16, 2011 at 20:13
  • 21
    > Windows (Explorer) does not allow you to create a folder that starts with a dot ('.'). This is for security/exploit reasons. Huh? In what way?
    – Synetech
    Jun 24, 2012 at 16:55
  • 5
    I second Synetech comment - if it is for "security/exploit reasons" then we need to call up Linus Torvald ASAP and tell him to plug this hole yesterday! Oct 12, 2012 at 2:56

You must log in to answer this question.