简体   繁体   English

为什么 touch.fileName 不会创建隐藏文件?

[英]why does touch .fileName does'nt create a hidden file?

I'm trying to create a hidden file and for some reason the command touch.fileName doesn't work.我正在尝试创建一个隐藏文件,但由于某种原因,命令touch.fileName不起作用。 I made sure that my folder and file settings are set to - don't show hidden folders and files.我确保我的文件夹和文件设置设置为 - 不显示隐藏的文件夹和文件。 I'm working with windows10, and Hyper.is terminal.我正在使用 windows10 和 Hyper.is 终端。

Windows doesn't care about files beginning with a dot. Windows 不关心以点开头的文件。 It just treats them like any old file.它只是将它们视为任何旧文件。 If you want to hide a file in Windows you must (also) change that attribute.如果要隐藏 Windows 中的文件,则必须(也)更改该属性。

attrib +h path-to-file 

You can run that from any cmd or PowerShell prompt.您可以从任何 cmd 或 PowerShell 提示符运行它。 It may also work at a bash prompt, though I don't have one in front of me to test it.它也可以在 bash 提示符下工作,尽管我面前没有一个可以测试它。 Using that dual method you can name your file.whatever and then add the above attribute and make it hidden to Windows as well.使用这种双重方法,您可以命名您的 file.whatever,然后添加上述属性并将其隐藏到 Windows 中。 (Bash should treat the.whatever file as hidden regardless of the Windows attribute.) (无论 Windows 属性如何,Bash 都应将 .whatever 文件视为隐藏文件。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM