简体   繁体   English

PowerShell ISE:调试从power-shell脚本调用的另一个power-shell脚本

[英]PowerShell ISE: Debug another power-shell script called from a power-shell script

I wants to debug a power-shell script which is called from my Main power-shell script using PowerShell ISE . 我想调试一个使用PowerShell ISE从我的主power-shell脚本调用的power-shell脚本。 Below is the sample code of my Main script. 下面是我的主脚本的示例代码。

$myLog = "$scriptPath\BuildRelease\logs\LaLogs.log"

$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
Set-Location -Path $scriptPath
Set-Location -Path BuildRelease
$paramList = "-ArgumentList -username $Login"

if($Mode -eq "False"){
    Start-Process powershell -ArgumentList '-noexit','-File', 'Release.ps1', $paramList
}

Here, I'm trying to step into Release.ps1 script using ISE . 在这里,我试图使用ISE进入Release.ps1脚本。

I have tried to do this by pressing F11 key, but instead of debugger going to this script, script gets executed (same as Step Over, instead of Step into). 我试图通过按F11键来执行此操作,但不是调试器转到此脚本,而是执行脚本(与Step Over相同,而不是Step into)。

Does anyone know how can I do this?? 有谁知道我怎么能这样做?

by using Start-Process you run a new instance of powershell. 通过使用Start-Process您可以运行powershell的新实例。 So that why you can't debug your script. 这就是为什么你不能调试你的脚本。 You can call other script in you script by using : 您可以使用以下命令调用脚本中的其他脚本:

.\\Release.ps1 -username $Login

And with this, you can debbug your script 有了这个,你可以对你的脚本进行调查

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM