windows 向任何文件添加自定义/新属性,而不考虑类型和扩展名,例如在 .txt 文件上设置“作者”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2591991/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding custom/new properties to any file regardless of type and extension e.g. setting 'Author' on a .txt file
提问by Vaibhav Garg
I want the ability add properties and tags to a file (specifically ebook files and ebook related properties in Windows 7 but interested to go so for as many OSes as possible)
我希望能够将属性和标签添加到文件(特别是 Windows 7 中的电子书文件和电子书相关属性,但有兴趣为尽可能多的操作系统添加属性)
For e.g. Example.txt or Example.doc or Example.epub should all store and carry properties like 'Author', 'Publication date', 'Tags' etc..
例如 Example.txt 或 Example.doc 或 Example.epub 都应该存储和携带诸如“作者”、“出版日期”、“标签”等属性。
the properties should be stored with the file itself. Such that if it is transferred to another system it retains the properties (even if i need to install 'my app' to support this function on the other machine)
属性应与文件本身一起存储。这样,如果它被转移到另一个系统,它会保留属性(即使我需要安装“我的应用程序”以在另一台机器上支持此功能)
How do I make this possible using .net (preferred) and what file system concepts should I learn to understand the underlying concepts and limitations to be able to implement this feature?
我如何使用 .net(首选)使这成为可能,我应该学习哪些文件系统概念来理解基本概念和限制才能实现此功能?
Any application that already does this? Thank you
任何已经这样做的应用程序?谢谢
回答by Chris Becke
Your options are:
您的选择是:
- Make a pact with your religions version of Satan.
- NTFS streams, with the restriction that copying to any non file stream supporting file system (FAT/FAT32) will strip the meta info.
- Stick to files that have the meta info built in.
- Store the meta info in a separate file and implement a massive array of shell extensions to monitor copy operations and re-sync the .fileinfo files when the user copies them.
- 与你的宗教版本的撒旦达成协议。
- NTFS 流,限制是复制到任何支持非文件流的文件系统 (FAT/FAT32) 将剥离元信息。
- 坚持使用内置元信息的文件。
- 将元信息存储在一个单独的文件中,并实现大量的 shell 扩展来监控复制操作并在用户复制时重新同步 .fileinfo 文件。
回答by Pedro Chust
You can use DSOFile from Microsoft, but only works with NTFS.
您可以使用 Microsoft 的 DSOFile,但只能使用 NTFS。
http://blog.rodhowarth.com/2008/06/how-to-set-custom-attributes-file.html
http://blog.rodhowarth.com/2008/06/how-to-set-custom-attributes-file.html