如何使用来创建文件。 Windows资源管理器中的点前缀

If you right click in Windows and try to make a new text file with a . period/dot in front of it:

如果在Windows中单击鼠标右键,然后尝试使用创建一个新的文本文件。 前面的句点/点:

如何使用来创建文件。 Windows资源管理器中的点前缀

Name the file...something like .gitignore, for example.

命名文件...例如,类似.gitignore的文件。

如何使用来创建文件。 Windows资源管理器中的点前缀

You'll get the "You must type a file name" error.

您将收到“您必须输入文件名”错误。

如何使用来创建文件。 Windows资源管理器中的点前缀

But, rather than typing .gitignore, if you include an ending dot also, like

但是,如果您还包括一个结束点,则不要键入.gitignore,例如

.gitignore.

.gitignore。

Then it works fine.

然后工作正常。

如何使用来创建文件。 Windows资源管理器中的点前缀

Thanks, Mads, for the tip!

谢谢, Mads ,给小费!

NOTE: We're assuming that you have "File name extensions" turned on, because if you don't, you're likely not a programmer. ;)

注意:我们假设您已打开“文件扩展名”,因为如果没有,则可能不是程序员。 ;)

如何使用来创建文件。 Windows资源管理器中的点前缀

UPDATED: Mads has created an "Add Empty File" Extension for VS that makes it easy to create . files as well!

更新: Mads为VS创建了一个“添加空文件”扩展名,使创建起来很容易。 文件也一样!

关于斯科特 (About Scott)

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

斯科特·汉塞尔曼(Scott Hanselman)是前教授,前金融首席架构师,现在是演讲者,顾问,父亲,糖尿病患者和Microsoft员工。 他是一位失败的单口相声漫画家,一个玉米种植者和一本书的作者。

如何使用来创建文件。 Windows资源管理器中的点前缀
如何使用来创建文件。 Windows资源管理器中的点前缀
如何使用来创建文件。 Windows资源管理器中的点前缀
About   关于 Newsletter 时事通讯
Hosting By 主持人
如何使用来创建文件。 Windows资源管理器中的点前缀

翻译自: https://www.hanselman.com/blog/how-to-create-a-file-with-a-dot-prefix-in-windows-explorer