Ragoler
Ragoler

Reputation: 1271

Invoking windows batch file from Linux

I have an application running only on Windows and a batch file that launches it. I want to invoke this batch file from Linux, meaning something like Linux batch will launch the windows batch with parameters and this in its turn run my application.

Can I do that? How?

Upvotes: 7

Views: 13658

Answers (5)

Mrchief
Mrchief

Reputation: 76218

Also look at winexe that allows you to execute windows commands/batch scripts without running ssh server.

Upvotes: 0

Andru Luvisi
Andru Luvisi

Reputation: 25318

The most direct way is probably to install an ssh server on the windows box. Cygwin includes an ssh server.

Depending on how precise your timing needs are, you might be able to have an "at" job on the windows box that runs periodically (every 5 minutes?) and runs if it sees that a particular file exists, deleting the file. Then you could use Samba/smbclient to create the file. You would need to turn on filesharing on the windows box for this to work.

If the windows box has a web server, you could write a CGI, and trigger it using wget or cURL.

Upvotes: 1

Aleksey Otrubennikov
Aleksey Otrubennikov

Reputation: 1181

This may cause a security issue. Our information security person did not allow me to invoke any programs directly.

The safer way is to set up server on Windows computer. This can be a web-server for example. And then invoke your process inside PHP/Perl/Python script.

Upvotes: 0

Peter K.
Peter K.

Reputation: 8108

Our build process currently goes the other way: a windows sever kicks off things on the Linux server using plink (part of PuTTY). You might be able to set something similar up.

Upvotes: 0

dsm
dsm

Reputation: 10395

You could install an ssh server in the windows box (Cygwin has one), then from linux do something like:

ssh user@windows-box c:/path/to/batch.cmd

and that should launch your application in the windows box.

Upvotes: 12

Related Questions