Windows – Execute a remote command on a Mac from Windows

batchmacsshwindows

What's the easiest way to execute a single command on a Mac from a remote Windows machine, via batch?

I would like something that works without a preset configuration (like SSH credentials) on either machines, as I need to apply this on several Win/Mac pairs (yes, I know it's less secure, but it's not relevant to my needs).

The macs all have a common user/password (in fact, they are on the same domain), and I want to automate this as painlessly as possible.

Best Answer

Anything like this, whether it's to a Mac or a Linux machine I use WinSCP, as it has good scripting support and is very easy to use. Just set up public keys for SSH to eliminate the password prompt.

Edit

Here's a batch file using PuTTY if you don't mind the password issue.

@echo off
echo command1; command2; commandn; exit>tmp_file
putty -ssh user@taget_machine -pw password -m tmp_file