0
我有我的.ps1
在同一文件夾中如何加載PowerShell腳本,這是在不同的目錄下,同時執行測試用例
一般我們用它來保存在directory1
和MT .tests.ps1
在directory2
寫劇本時,測試文件和腳本文件都在同一個文件夾
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
,但我有他們不同的文件夾中,如下所示,這樣我怎麼能工作正常加載路徑,這樣腳本文件應該得到加載