我在尝试执行另一个文件中的PowerShell函数时遇到了大问题。
这是我的首字母。ps1文件:
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$file = Get-Item $scriptDir\JSONFile1.json
$plaintext = $file | Get-Content
.\Functions\Add-Folder.ps1 -AdlsAccountName "Hello World"
文件
Add-Folder.ps1
包括以下内容:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string] $AdlsAccountName
)
Write-Host $AdlsAccountName
但当我执行这个时。ps1脚本我收到以下错误:
##[error]The term '.\Add-Folder.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.