# Execute Windows Run Command or Some Windows Batch Process from Android

Can we execute a Windows run command from an Android device? Like for example I want to open a file in PC using my Android device such as Run>C:\abc.exe.

Or you can say I want to run a batch process (Exe File) placed in PC from my Android device.

• Why don't you try remote desktop? – roxan Apr 11 '12 at 13:25
• Please don't just throw every version tag onto your questions. It is not the purpose of the tagging system. – eldarerathis Apr 11 '12 at 13:27

One option would be to install and set up SSH on the target PC. http://sshwindows.sourceforge.net/

You can then use any of the many SSH android clients to connect to the target PC and you will have command line access.

• This is a dangerous advice: SSH Windows is positively ancient (7 years since the latest release, for a critical piece of software) and unsupported. Better alternatives exist, and Wikipedia lists most of them. – Martin Tapankov Apr 11 '12 at 14:40
• Good point, if you want this to be accessible from outside your home network, you certainly should seek an up to date option. – Brandorf Apr 11 '12 at 15:12

I think we can achieve this thing using Sockets. we need to send a command from device to PC using socket. But on PC side we must have another socket which can manipulate the incomming command from device .Then we can execute exe batch or jar file on the basis of incomming string.

Like that suppose we send a command from device to pc " Java -jar " C:\deviceExecute.jar " On pc side we get this command through socket as a string (executejar) and then run this

if(executejar!=null || executejar!="") {

Runtime runtime = Runtime.getRuntime(); Process proc = runtime.exec(executejar);

}

• Welcome to Android Enthusiasts! Note that this site is intended for Android (power) users, not programmers, so please only provide answers that do not involve creating your own program. – THelper Feb 14 '13 at 12:56