How Do You Create Files Without File Extensions like .gitconfig in Windows Explorer?

Today I worked with a friend on a small project and he wanted to add a .gitconfig-file. He created a new “New Text Document.txt”-file in Windows Explorer and just renamed it to .gitconfig. But Windows Explorer didn’t accept this:

you-must-type-a-file-name

Now what can you do? My friend fired up a console window and he entered this command:

rename "New Text Document.txt" .gitconfig

This command worked and he got the file he wanted. But isn’t this a bit cumbersome? Yes, it is. Because instead of firing up a command window, Windows Explorer allows you to create a file like .gitconfig in a much simpler way.

If you want to have a file like
.gitconfig
all you have to do is to create a file
.gitconfig.
in Windows Explorer. Note the dot at the end of the filename. If you have just a dot at the end, Windows Explorer won’t complain about a missing file extension. And in addition, it will remove that dot at the end when it has accepted the file name. That means a filename “.gitconfig.” will create the file “.gitconfig”.

Try it! It’s pretty cool, pretty simple and straight forward. Happy coding! :)

Share this post

Comments (2)

  • Einstieg in die Welt der Container: Docker-Grundlagen für .NET-Entwickler Reply

    […] Datei hat keine Dateierweiterung. In der aktuellen Version von Windows 10 lässt sich eine Datei ohne Dateierweiterung auch problemlos im Windows Explorer erstellen. In älteren Windows-Version ist dies nur über einen […]

    February 19, 2019 at 7:49 am
  • Leon Fairley Reply

    That worked perfectly for .gitkeep – thanks for saving me the time and Command window.

    July 1, 2019 at 8:52 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.