1

I would like to open a password protected NAS folder through IP address in windows 10 file explorer. I write my code in Java Eclipse.

I have a small code that opens the folder but then I have to write in username and password manually.

Is there a way to open the folder in file explorer already authenticated with given username and password?

Authentication window

Thank you in advance for your help!

Runtime.getRuntime().exec("explorer.exe /n, /e, "+ip);
Boki
  • 21
  • 1
  • Related: [How to open password protected directory (in Windows) in java?](https://stackoverflow.com/questions/45295958/how-to-open-password-protected-directory-in-windows-in-java) – Lino Dec 03 '21 at 09:14
  • @Lino I have found this answer but this is to open a specific file from location and use the data to console. I want to open a folder in file explorer. I don't want to access a specific file with data. – Boki Dec 03 '21 at 09:20

1 Answers1

0

Using "net use" command I can teach the computer the username and admin for the authentication, then simply open the folder using explorer.exe

String ip = "\\\\192.168.10.199";
String user = "admin";
String pw = "admin";

Runtime.getRuntime().exec("net use " + ip + " /user:" + user + " " + pw);
Runtime.getRuntime().exec("explorer.exe /n, /e, "+ip);
Boki
  • 21
  • 1