简体   繁体   English

Powershell中调用函数时出错

[英]error when calling function in powershell

when i call function in a script , i get error. 当我在脚本中调用函数时,出现错误。 can someone please help? 有人可以帮忙吗?

check_mul_f_mul_d : The term 'check_mul_f_mul_d' is not recognized as the name of a cmdlet, function, script file, or operable program. check_mul_f_mul_d:术语“ check_mul_f_mul_d”未被识别为cmdlet,函数,脚本文件或可运行程序的名称。 Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 检查名称的拼写,或者是否包含路径,请验证路径是否正确,然后重试。 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:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException 在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

Code: 码:

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

........

}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM