Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple commands using batch and Plink? [duplicate]

Tags:

ssh

putty

plink

Hello I am trying to use a batch file to log into a server using plink, go to specific directory and run commands. I can not get this to work. Appreciate any help.

plink -t -ssh [email protected] -pw xxxxx
cd /home/wonderd/public_html/dev.xxxx.com
./shell/indexer.php --reindex catalog_product_price
like image 221
Daniel A Avatar asked Oct 01 '15 17:10

Daniel A


People also ask

How do I run multiple commands in one batch file?

Instead of scheduling multiple Windows Tasks that may overlap, use the "start /wait" command a batch file (. bat) to automatically run multiple commands in sequential order.

Can a batch script file run multiple commands at the same time?

You can run two commands in one line in Windows Command Prompt. For that, you need to create a batch script file using Notepad. Below, we have shared the two best methods to run multiple commands in CMD on Windows 10 computers. Let's check out.


1 Answers

First I think you have to write the machine name or IP after the plink call The second issue is that plink run always from root directory so you have to send couple commands together separated by ;

like this :

plink.exe <full name of machine / IP> "command one; command 2"
like image 60
Hava L. Avatar answered Sep 28 '22 00:09

Hava L.