Using Java, you can pass the net SHARE command to the exec method of the Runtime class, and then parse the output from the Process class to get the appropriate network path in your directory. The output of the net SHARE directory_name command is as follows:
Share name Share Path C:\Share Remark Maximum users No limit Users Caching Manual caching of documents Permission user, FULL
You need to get the Path key value from the above output. Below is the pseudo code on how you can do this:
Process process = Runtime.getRuntime().exec("net SHARE directory_name"); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); StringWriter writer = new StringWriter(); String line; while (null != (line = reader.readLine())) { writer.write(line); } System.out.println(writer.toString());
source share