views:

47

answers:

2

Hi Guys

How can i get all the shared folders in Windows XP in my local system using java.

Thanks

+1  A: 
net share   

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

org.life.java
Thanks it works perfectly.
sadananda salam
@user457708 you are welcomed :-)
org.life.java
A: 
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) {
    }
sadananda salam