这里是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
值
最佳答案
@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
然后像这样调用 bat :
$a = get-date -format "MMM-d-yyyy"
Start-Process "D:\Script\send_report.bat" $a
关于powershell - 将 powershell 变量传递给批处理脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26263699/