trouble with execute command at cmd in java -
i want reboot adsl modem , code . code going until reach login section , must enter username(admin) , press enter . problem /c
not work (/c admin
). how can write admin , press enter ?
public static void main(string[] args) throws ioexception { string tel = "telnet 192.168.1.1 23"; string user = "admin"; string pass = "admin"; string reboot = "reboot"; string command = "cmd /c start cmd.exe /c"+tel; process child = runtime.getruntime().exec(command); }
my mean of login section picture:
process child = runtime.getruntime().exec(command); writer writer = new java.io.outputstreamwriter(child.getoutputstream()); writer.append("string"); writer.flush();
after read input again see if asks password or whatever does.
Comments
Post a Comment