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

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

问题描述

我需要在 Windows 和 Linux 上隐藏文件和文件夹.我知道附加一个."到文件或文件夹的前面将使其在 Linux 上隐藏.如何在 Windows 上隐藏文件或文件夹?

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?

推荐答案

对于 Java 6 及更低版本,

For Java 6 and below,

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

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

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

您应该了解一些有关 win32-api 或 Java Native 的知识.

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

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

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