当我在脚本中调用函数时,我收到错误。有人可以帮忙吗?
check_mul_f_mul_d:术语' check_mul_f_mul_d'不被识别为cmdlet,函数,脚本文件或可操作的名称 程序。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。 在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:String)[],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
........
}
答案 0 :(得分:1)
您应该在函数调用之前放置函数定义