Using Powershell ISE I often set breakpoints in a script and start the script from command line. ISE then stops at the breakpoint and lets me debug from there. How do I do the same from Terminal in Visual Studio Code? Below is a script just to show you what I mean. Starting from a terminal I would write:
.\hello.ps1 -firstName "firstName" -lastName "theLastName"
But doing that from terminal it just starts a new window.
param (
[string] $firstName,
[string] $lastName
)
Write-Host "Starting test script"
try
{
Write-Host "Hello $firstName $lastName"
}
catch
{
Write-Error "Error. Exception: $_"
}
Write-Host "Script done"