这是powershell脚本
$a = get-date -format "MMM-d-yyyy"
Start-Process "D:\Script\send_report.bat"
send_report.bat使用blat发送电子邮件
D:
cd "D:\Program Files (x86)\blat321\full"
blat -s "Daily Report" -i "Our Team" -to member1@team.org,member2@team.org -body "Please see attached." -priority 1 -attach D:\Script\Daily_Report.xlsx
如何将$a
插入send_report.bat?我希望“每日报告”旁边的$a
价值
答案 0 :(得分:3)
在PowerShell脚本中,将$a
作为参数添加到批处理文件中:
Start-Process "D:\Script\send_report.bat" $a
在批处理文件中,将参数引用为%1
。
blat -s "Daily Report %1" -i "Our Team" -to member1@team.org,member2@team.org -body "Please see attached." -priority 1 -attach D:\Script\Daily_Report.xlsx
答案 1 :(得分:3)
@echo off
cd /d "D:\Program Files (x86)\blat321\full"
set "the_date=%~1"
blat -s "Daily Report" -i "Our Team" -to member1@team.org,member2@team.org -body "Please see attached." -priority 1 -attach D:\Script\Daily_Report_%the_date%.xlsx
并像蝙蝠一样打电话:
$a = get-date -format "MMM-d-yyyy"
Start-Process "D:\Script\send_report.bat" $a