Function SCP-ImplementationFiles($selectedDirectory, $fileName) {
Write-Host $rdfFile.GetType() $rdfFile.Name
SCP-ImplementationFiles($directoryPrompt, $rdfFile.Name)
我的写主机正在提供输出
System.IO.FileInfo file1.pdf
但是,当我将其传递给函数时,第二个参数始终为空/空
我将函数定义为靠近脚本顶部(以防万一)
不是How do I pass multiple parameters into a function in PowerShell?
的副本我不尝试从提示符处调用函数。我试图从脚本中调用该函数。如果我删除','(逗号),编辑器会告诉我缺少','
我已经尝试过使用这些函数来查看我的函数定义是否有误
Function SCP-ImplementationFiles {
param([string]$selectedDirectory, [string]$fileName)
Write-Host $selectedDirectory
Write-Host $fileName
}
Function SCP-ImplementationFiles([string]$selectedDirectory, [string]$fileName) {
Write-Host $selectedDirectory
Write-Host $fileName
}
Function SCP-ImplementationFiles($selectedDirectory, $fileName) {
Write-Host $selectedDirectory
Write-Host $fileName
}