【发布时间】:2017-01-01 13:22:14
【问题描述】:
我想调试一个 power-shell 脚本,该脚本是使用 PowerShell ISE 从我的主 power-shell 脚本调用的。下面是我的 Main 脚本的示例代码。
$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
}
在这里,我正在尝试使用 ISE 进入 Release.ps1 脚本。
我曾尝试通过按F11 键来执行此操作,但不是调试器转到此脚本,而是执行脚本(与 Step Over 相同,而不是 Step into)。
有谁知道我该怎么做??
【问题讨论】:
-
effin 递归... ;(
-
开个玩笑,“Start-Process powershell”背后的逻辑是什么?
-
我正在另一个实例上执行 Release.ps1 脚本,这就是我使用 Start-Process powershell 的原因。这是客户希望我这样做的事情。
-
调试如何?如果您按照 Nico 的建议知道导致它失败的条件,则可以手动运行它。如果您想在实时环境中对其进行测试,您需要设置适当的错误捕获,将错误记录到文件中或在弹出窗口或其他内容中显示它们。如果您知道错误但需要查看变量,那就是另一回事了。我们需要知道你想做什么。
标签: powershell powershell-2.0 powershell-ise script-debugging