方法一: 

Get-Content "D:\PowershellScripts\Test\ErrorMailNotice.ps1" | Invoke-Expression

 

方法二:

$script = "D:\PowershellScripts\Test\ErrorMailNotice.ps1"

.$script

 

相关文章: