2017-08-03 128 views
0

當我在腳本中調用函數時,出現錯誤。有人可以幫忙嗎?在powershell中調用函數時出錯

check_mul_f_mul_d:術語'check_mul_f_mul_d'不被識別爲cmdlet,函數,腳本文件的名稱或可操作的程序 。檢查名稱的拼寫,或者如果包含路徑,請驗證路徑是否正確,然後重試。 At I:\ Temp \ IPCFileCheckNew \ Script \ getfilename.ps1:58 char:10 + check_mul_f_mul_d -START_DATE $ START_DATE -END_DATE $ END_DA ... + ~~~~~~~~~~~~~~~ ~~ + CategoryInfo:ObjectNotFound:(check_mul_f_mul_d:字符串)[],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException

代碼:

if ($FILENAME -eq "ALL") { 
     Write-Output "Check all files of yesterday..." 
     WRITE-HOST $TempBadoutfile $Tempokoutfile $CNT_FILE 
     check_mul_f_mul_d -START_DATE $START_DATE -END_DATE $END_DATE -ALLFILE_ARRAY $ALLFILE_ARRAY -CNT_FILE $CNT_FILE 
     -REPORTPATH $REPORTPATH -TempBadoutfile $TempBadoutfile -TempOKoutfile $Tempokoutfile} 
else{........} 




function check_mul_f_mul_d { 

param ([String]$START_DATE, 
[String]$END_DATE, 
[String]$FILENAME, 
[String]$HSTCHECK, 
[int]$CNT_DATE, 
[int]$CNT_FILE, 
[String[]]$ALLFILE_ARRAY, 
[string]$REPORTPATH, 
[STRING]$TempBadoutfile, 
[STRING]$TempOKoutfile 
) 
write-host $ALLFILE_ARRAY $CNT_FILE 

write-host $start_date $end_date 
WRITE-HOST $TempOKoutfile $TEMPBADOUTFILE 

........ 

} 

回答

1

你應該把函數定義的函數調用

+0

OMG之前。 ...太簡單了.. thx !!! – ella

+0

你很好:)) – tung