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:42

You could also use Command Prompt with move: move x.extension .extension

查看更多
看我几分像从前
3楼-- · 2019-01-03 12:43

As an addition, if have sublime text installed in your development computer you can drag the file to your opened sublime window, right click the filename -> rename and enter whatever name even without any extension. This worked for me.

查看更多
太酷不给撩
4楼-- · 2019-01-03 12:45

You can do this in any program other than Explorer, e.g. Notepad, cmd.exe etc.

You just can't do it in Explorer, and Raymond Chen has offered an explanation as to why not.

查看更多
再贱就再见
5楼-- · 2019-01-03 12:49

Go to command prompt, cd to the appropriate folder and type:

notepad .htaccess

After confirmation dialog the file will be created and you will be editing it directly. If you just want to create an empty file, try

echo. > .htaccess
查看更多
祖国的老花朵
6楼-- · 2019-01-03 12:54

Just type .htaccess. as filename. Notice the dot at the end of htaccess. This will change in Windows to .htaccess without a dot at the end.

查看更多
三岁会撩人
7楼-- · 2019-01-03 12:55

Even if you don't have any third party editor (Notepad++ etc.) then also you can create files with dot as prefix.

To create .htaccess file, first create htaccess.txt file with Context Menu > New Text Document.

Then press Alt + D (Windows 7) and Ctrl + C to copy the path from the Address bar of Windows Explorer.

Then go to command line and type code as below to rename your file:

rename C:\path\to\htaccess.txt .htaccess

Now you have a blank .htaccess without opening it in any editor.

Hope this helps you out.

查看更多
登录 后发表回答