I want to run a batch file present on my remote computer

0

I want to run a batch file present on my remote computer but I am getting an error that you don't have permission to access the share.

errorcode--: 0x80070035 the network Path was not found

Please help me out

Thanks in advance

public class Remotly {

    public static void main(String arr[]) {
        String cmd;
        try {
            Process r = Runtime.getRuntime().exec("cmd /c start \\\\xx.xx.xx.xx\\D:\\batch\\sas.bat");
        } catch (Exception e) {
            System.out.println("Execution error");
        }
    }
}
java
asked on Stack Overflow Sep 30, 2015 by Pankaj Dagar • edited Sep 30, 2015 by Madhawa Priyashantha

1 Answer

1

The UNC path is incorrect, it contains a drive letter.

\\\\xx.xx.xx.xx\\D:\...

Instead, the folder must be shared by a name

\\\\xx.xx.xx.xx\\DriveD\...

To use it, you must map the network drive before, e.g. via

net use * \\\\xx.xx.xx.xx\\DriveD <Password> /User:<Username>
answered on Stack Overflow Sep 30, 2015 by Thomas Weller • edited Sep 30, 2015 by Thomas Weller

User contributions licensed under CC BY-SA 3.0