开发者

How to get all the shared folders in Windows XP using Java

开发者 https://www.devze.com 2023-01-18 18:05 出处:网络
How can i get all the shared folders in Windows XP in my local system using开发者_C百科 java. Thanksnet share

How can i get all the shared folders in Windows XP in my local system using开发者_C百科 java.

Thanks


net share   

Try executing this command in windows machine.
Here is sample how to execute commands from java code


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) {
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号