如何从呼叫者PS调试被呼叫者PS脚本

时间:2020-07-20 13:01:48

标签: debugging powershell-3.0 invoke-command

am具有一个名为pscodeSrc.ps1的powershell脚本文件,该文件进行了一些操作并带有日期变量-当前日期-(get-date),并使用此datevariable作为参数/参数传递给第二个powershell代码,pscodeTarget.ps1

$pstargetfilewithparam = "pscodeTarget.ps1 " + $mycurrentdate

正在使用

invoke-expression 'powershell.exe . \${$pstargetfilewithparam'

面临的问题是,无法调试这些PS文件。当我尝试在pscodeSrc.ps1中放置一个断点,并且想调试第二个ps代码文件时,断点没有命中!

在这种情况下,我如何调试PS代码。类似于.net调用DLL方法,我希望Visual Studio跳入DLL的方法并继续调试该LOC,并在执行完成后返回到调用方PS代码。

0 个答案:

没有答案