I am trying to share a folder in java. I want to share a folder with several users. I use the following command:
net share sharefolder=<drive path> /GRANT:<username>,FULL
the above command shares the specified path folder with the username with FULL acess ie read and Write.
Can anyone help me out?
For multiple users, you can use the following command in your Java code
net share sharefolder=<drivepath> /GRANT:<username>,Full /GRANT:<username>,Full
You can add as many users as you need. Thank,
Use the java process to run your command:
String yourCommand = "net share sharefolder=<drive path> /GRANT:<username>,FULL"; Process p = Runtime.getRuntime().exec(yourCommand ); // To get the output of command BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
Source: https://habr.com/ru/post/1583974/More articles:Настройка jenkins с помощью git по ssh - gitOpencv Python - evaluating affinity from a combination of functions + homology - pythonR Shiny - host your own apps? - rDifference between column and column in css - javascriptКак установить приложение для Android в каталоге system/app без внедренного устройства, чтобы пользователь не смог удалить это приложение - androidEvacuation sequences displayed in socket messages - cJava 8 functionality: lost type information in the middle of the path - javaSwitching a class to a button group - javascriptDocker-compose: nginx does not work with django and gunicorn - dockerИсключить родную библиотеку в Gradle Android build - androidAll Articles