Creating Linux dot files in Windows

Ever tried creating a file Linux style dot file like .htaccess or .gitignore in Windows Explorer? It gives you a "You must type a file name." error message. This might lead people to think that Windows doesn't support these file names. If you use a command line, you know that this is definitely possible in Windows. In fact, you can even create dot files in Windows Explorer quite easily with this little know trick.

To create a filename that start with a period "." but has no extension, like .txt, simply add a period to the end of the filename.

For example, enter the file name:

    .htaccess.

…to create:

    .htaccess

Windows will automatically drop the trailing period for you but completely forget that there is nothing before the leading period.

This tip also work when renaming files. For example, you can rename htaccess.txt to .htaccess


Add a comment:

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