Quantcast
Channel: Pochampalli IT Labs
Viewing all articles
Browse latest Browse all 261

Batch script to run perl file in linux machine | How to connect to linux in batch script and run perl file

$
0
0

To run a perl file placed in linux machine from batch file use "plink" utility of PuTTY in batch scripting. 

As shown below write batch script and as on execution of batch file in windows machine, the perl will be triggered in linux machine. 

PuTTY should be installed in the windows(source machine) and plink.exe should be there in the installation folder and it does the job of running perl file in linux machine. 

perlexecutioninlinux.bat

@echooffset"destinationUser=linuxadmin"set"destinationPassword=MyPassword#123"set"destinationHost=11.123.4.567"set"scriptPath=/home/linuxadmin/AutomationProject/my-perl-file.pl"

plink -pw %destinationPassword% -batch %destinationUser%@%destinationHost%"perl %scriptPath%"

timeout /t 5 /nobreak
exit

I hope you find this useful! If you like it, pls do subscribe my YouTube channel for automation or tech updates.

Viewing all articles
Browse latest Browse all 261

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>