且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Java在Windows上隐藏文件/文件夹

更新时间:2022-10-17 21:13:39

对于Java 6及更低版本,



您将需要使用本机调用,这里是Windows的一种方式

  Runtime.getRuntime ().exec(attrib + H myHiddenFile.java); 

您应该了解一下有关win32-api或Java Native的信息。


I need to make files and folders hidden on both Windows and Linux. I know that appending a '.' to the front of a file or folder will make it hidden on Linux. How do I make a file or folder hidden on Windows?

For Java 6 and below,

You will need to use a native call, here is one way for windows

Runtime.getRuntime().exec("attrib +H myHiddenFile.java");

You should learn a bit about win32-api or Java Native.