如何使用java在本地系统中获取Windows XP中的所有共享文件夹。
由于
答案 0 :(得分:0)
net share
尝试在Windows机器中执行此命令 Here is sample how to execute commands from java code
答案 1 :(得分:0)
try {
String line = null;
String[] commands = new String[] { "cmd", "/C", "net share" };
Process child = Runtime.getRuntime().exec(commands);
InputStream ins = child.getInputStream();
BufferedReader buffReader = new BufferedReader(
new InputStreamReader(ins));
while (!(line = buffReader.readLine()).trim().equals(
"The command completed successfully.")) {
System.out.println(line);
}
} catch (Exception exp) {
}