使用Java在Windows上隐藏文件/文件夹 [英] Make a File/Folder Hidden on Windows with Java

查看:130
本文介绍了使用Java在Windows上隐藏文件/文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Windows和Linux上隐藏文件和文件夹。我知道在文件或文件夹的前面附加一个'。'会使它隐藏在Linux上。如何在Windows上隐藏文件或文件夹?

解决方案

对于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.

这篇关于使用Java在Windows上隐藏文件/文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆