Script causes Powershell to open in Console Host instead of Windows Terminal

Kanishk Nishar 0 Reputation points
2023-09-27T11:52:28.3466667+00:00

I am trying to run a script that opens a powershell instance for every sub-directory and runs the command whisperPath

Here's the code:

Get-ChildItem -Directory -Recurse | ForEach-Object { Start-Process -FilePath "pwsh.exe" -ArgumentList "-NoExit -Command Set-Location -LiteralPath '$($_.FullName)'; whisperPath" }

When I run the code on my desktop, each instance of Powershell opens in Windows Terminal successfully but that is not the case on my laptop which opens each Powershell window in Windows Console Host despite WT being the default terminal manager on my laptop:

User's image

About PC:

Device name	Lance
Processor	AMD Ryzen 5 5500U with Radeon Graphics            2.10 GHz
Installed RAM	16.0 GB (15.3 GB usable)
Device ID	9E1759C8-2697-492C-A8BC-D1188CE5ECB1
Product ID	00356-02656-70053-AAOEM
System type	64-bit operating system, x64-based processor
Pen and touch	No pen or touch input is available for this display

Edition	Windows 10 Home
Version	22H2
Installed on	‎27-‎08-‎2023
OS build	19045.3448
Experience	Windows Feature Experience Pack 1000.19044.1000.0

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,217 questions
{count} votes