在powershell中调用函数时出错

当我在脚本中调用函数时,我得到错误 . 有人可以帮忙吗?

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 ... ~~~~~~~~~~~~~~~~~分类信息: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

........

}

回答(1)

2 years ago

您应该在函数调用之前放置函数定义