运行 多个带有 powershell 的 javascript

Run multiple javascripts with powershell

以下两点由我完成

  1. 我的本地机器上有两个不同的 phantom js 脚本 将捕获屏幕截图并将其保存在我的本地。

  2. 我有一个 powershell 脚本可以通过邮件发送捕获的图像。

我的要求如下

需要一个整合脚本,我可以在一个脚本中配置以上两项,然后我会将我的任务计划程序更新为 运行 整合脚本,以便每天下午 6 点发送邮件。

我正在寻找 powershell 作为我的最终整合脚本,它将 运行 phantom js 首先 运行 send_mail.ps1 .

我使用以下命令 运行

 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)

我只需要一个合并脚本来 运行 以上 3 个命令。

您应该能够从 powershell 启动 phantomjs exe。

它会像

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**