2

ここに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

$asend_report.batに挿入するにはどうすればよいですか? $a「日報」の次の値をお願いします

4

2 に答える 2

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
于 2014-10-08T18:25:12.237 に答える
3

In your PowerShell script, add $a as a parameter to the batch file:

Start-Process "D:\Script\send_report.bat" $a

In you batch file reference the parameter as %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
于 2014-10-08T18:23:44.430 に答える