简体   繁体   中英

Run multiple javascripts with powershell

Following two points are completed from my end

  1. I have two different phantom js scripts on my local machine which will capture the screenshots and save it my local.

  2. I have one powershell script to send the captured images through mail.

My requirement is as below

Need one consolidated script where i can configure the above two in one script and then i will update my task scheduler to run the consolidated script to send the mail daily at 6PM.

I am looking for powershell as my final consolidated script which will run the phantom js first and run the send_mail.ps1 .

I have used following commands to run

 C:\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin> .\phantomjs.exe I:\my_code\capture_screenshot1.js  --> (Capture screenshot and put under C:\Images)
 C:\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin> .\phantomjs.exe I:\my_code\capture_screenshot2.js  --> (Capture screenshot and put under C:\Images)
 C:\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin> cd I:\my_code\
 I:\my_code> .\send_mail.ps1  --> (Send Mail from taking the images from C:\Images)

I just need single consolidated script to run the above 3 commands.

You should be able to start the phantomjs exe from powershell.

It would be something like

CD c:\path\to\phantomjs
.\phantomjs.exe I:\my_code\capture_screenshot1.js
.\phantomjs.exe I:\my_code\capture_screenshot2.js
**contents of sendmail.ps1**

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM