How to manually create a file with a . dot prefix

2019-01-03 12:29发布

I want to create a .htaccess file manually and discovered it seems impossible through the windows UI. I get a you must type a filename. message. There has to be a way to create files with . as a prefix in windows.

Can this be done manually?

enter image description here

12条回答
淡お忘
2楼-- · 2019-01-03 12:56

Within Notepad select File > Save As...

File name: ".whatever you want" (with the leading dot)

You can do it in Explorer (in Windows 7) by adding a period at the end of the filename:

.whatever you want.

Windows will automatically remove the trailing dot when you validate.

查看更多
劫难
3楼-- · 2019-01-03 12:58

You can save it using SAVE AS dialog using ".something"

查看更多
在下西门庆
4楼-- · 2019-01-03 12:58

In windows, just go to the folder using cmd and type the following command DIR>.htaccess.

This command will create a .htaccess file and will dump some data in it. Remove the data and it can be used as .htaccess file

查看更多
对你真心纯属浪费
5楼-- · 2019-01-03 13:00

If you start Notepad and then File -> Save As -> Write .htaccess and choose "All Files" as the type - then it will create the .htaccess file for you.

Notepad save as .htaccess

查看更多
一纸荒年 Trace。
6楼-- · 2019-01-03 13:04

Windows 7, 8 & 10

This is dead easy since Windows 7. In File Explorer, right click anywhere and create a new file. Type the new filename as .something. (notice the appended period) and press enter twice, job done.

Demonstrating how to create a file with no name in File Explorer.

So instead of being prompted with

You must type a file name.

You will instead be prompted with

If you change a file name extension, the file might become unusable.

查看更多
在下西门庆
7楼-- · 2019-01-03 13:05

Use something like notepad++ or even notepad and 'save as' and enter the name .htaccess that way - always found it weird, but it lets you do it from a program!

查看更多
登录 后发表回答