# How do you make another computer run a batch file from your computer?



## br45entei (Oct 24, 2012)

I have a laptop that I use as a sort of 'network server', though its really not. I have a Local Area Connection completely set up along with file and printer sharing, and I play a client game on my desktop that is linked to a software server that is hosted on the laptop. The laptop is jacked right into the router, and so is my desktop. I have to periodically update files on the laptop from my desktop to keep the game running nicely, and I have to re-start the software server manually at the laptop using a batch file I can view and edit on my desktop.

So, if I can view and edit said batch file, then why can't I make the *laptop run the batch from my desktop*? (It's a fair walk from desktop to laptop.) If you guys can make this work, that would be great. I don't know for sure, but you might need the ip addresses for both computers(found using cmd > ipconfig):

Desktop's IP: 192.168.0.106
Laptop's IP: 192.168.0.105

Thanks for reading, and I hope someone can help! I hope that wasn't too complicated to explain.

TSG SysInfo output:

Tech Support Guy System Info Utility version 1.0.0.2
OS Version: Microsoft Windows XP Home Edition, Service Pack 3, 32 bit
Processor: Intel(R) Celeron(R) CPU 2.53GHz, x86 Family 15 Model 4 Stepping 1
Processor Count: 1
RAM: 1014 Mb
Graphics Card: Intel(R) 82865G Graphics Controller, 96 Mb
Hard Drives: C: Total - 73171 MB, Free - 24372 MB;
Motherboard: Dell Computer Corp., 0CF458
Antivirus: AVG Anti-Virus Free Edition 2013, Updated: Yes, On-Demand Scanner: Enabled


----------



## br45entei (Oct 24, 2012)

P.S. I would prefer not to use Remote Desktop, but if no one can find any other way, then I guess I could try that.


----------



## loserOlimbs (Jun 19, 2004)

psexec in the pstools suite from systernals.

You must have access to the machine (domain level) or use the remote machines account (Sam on the local machine will not have the admin access of John on the remote).

Syntax is:


```
psexec \\remoteMachine C:\Users\John\Desktop\Batch.bat
```
and, for more info run psexec /?


----------



## br45entei (Oct 24, 2012)

Thank you so much, I did not even think to look at Sysinternals! I use thier Procexp(Process Explorer) instead of task manager.


----------



## br45entei (Oct 24, 2012)

Well, shoot, I'm running Windows XP Home Edition on both computers, and apparently psexec.exe does not like Home Edition... Any other suggestions?


----------



## loserOlimbs (Jun 19, 2004)

Hmmm... Then it gets more complicated.

I think you can use Powershell... You will need to install PowerShell v2 on both machines,

then there are two possible routes

```
Invoke-Command -ComputerName {serverName} &#8211;ScriptBlock { commands }
```


----------



## loserOlimbs (Jun 19, 2004)

I am working on the second approach, as I found that first one on stack overflow...


----------



## Ent (Apr 11, 2009)

Does the latest suggestion work?
This seems like one of those things that should be so much easier than it is.


----------



## loserOlimbs (Jun 19, 2004)

Looks like you can do this too...

First, you need to enable the Windows Remote Management Service (On remote machine)

Then, open the cmd, and type ""winrm quickconfig" and then yes to all questions.

Now, you can use the powershell as a terminal by typing on the machine you are using 

"enter-pssession 192.168.0.105"

Now that you are connected you can call the script / program by typing the full path on the remote machine, 

ex: 
"C:\Users\John\Batch.bat"


----------



## gwashington (Jul 2, 2007)

my spidey senses are tingly for reading this. XD


----------



## Rollin_Again (Sep 4, 2003)

Another simple idea is to create a "monitored" directory on the laptop and use Windows task scheduler to run a script that will check to see if the directory is empty. If the directory is empty the script will do nothing. If the directory contains a batch file or any other file then you can issue the command to execute the batch file. Just schedule the task to run on your laptop at your specified intervals and also make sure to purge the monitored directory after the batch file is executed so you don't get stuck in an endless loop. This monitored directory can either be located on the laptop local drive or could even be a mapped network pointing to your desktop.

Rollin


----------

