Share via

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

Anonymous
2023-09-27T11:55:00+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 9EB1 Product ID 00EM 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
Windows for home | Windows 10 | Devices and drivers

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2023-10-02T10:47:01+00:00

    I managed to fix the issue by reinstalling Powershell while copying settings.json from my desktop just to be safe. Don't know what the issue was but the script works properly now.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2023-10-06T13:54:14+00:00

    You may create a new test account, and switch to the newly created account to see if the function is normal. Because this cannot be ruled out due to the wrong configuration. Visit****Create a local user or administrator account in Windows (microsoft.com)****for more details.

    • Create a local user account
    1. Select Start > SettingsAccountsFamily & other users. (In some versions of Windows you'll see Other users.)
    2. Select Add someone else to this PCI don't have this person's sign-in information, and on the next page, select Add a user without a Microsoft account.
    3. Enter a user name, password, or password hint - or choose security questions—and then select Next.
    • Change a local user account to an administrator account
    1. Select StartSettingsAccounts.
    2. Under Family & other users, select the account owner name (you should see "Local Account" below the name), then select Change account type.
    3. Under Account type, select Administrator, and then select OK.
    4. Sign in with the new administrator account.

    Note: If the new account is normal, please do not delete the old account before backing up the data of the old account to avoid any data loss.

    You may also Perform a clean boot (microsoft.com) to see if it is normal, this is a troubleshooting step. In this mode, we can further confirmed whether it is caused by system problems or third-party software or personalized Settings. So please be patient.

    Disclaimer*: A “clean boot” starts Windows with a minimal set of drivers and startup programs. It helps to determine whether a background program is interfering with your game or program and to isolate the cause of a problem.*

    These steps of "clean boot" might look complicated at first glance. However, to avoid any trouble for you, please follow them in order and step-by-step so that it will help you get you back on track.

    0 comments No comments
  3. Anonymous
    2023-10-05T19:19:38+00:00

    I managed to fix the issue by reinstalling Powershell while copying settings.json from my desktop just to be safe. Don't know what the issue was but the script works properly now.

    Nevermind. IDK what happened. The issue has come back. New instances of pwsh open in Console Host and not Windows Terminal as it used to.

    0 comments No comments
  4. Anonymous
    2023-09-28T12:53:12+00:00

    Is your desktop and laptop both running Windows 10? Since in Windows 11, Command Prompt and PowerShell by default open with Windows Terminal. However, in Windows 10, Windows Terminal is not included as part of the system by default and needs to be manually installed, and some functionalities might differ from Windows 11.

    Or you may disable the Legacy Console mode. Right-click on the PowerShell title bar and choose the Properties menu option. Choose the first tab, Options. Then uncheck the box at the bottom of the page describing Use legacy console. Press the OK button to apply.

    Meanwhile, you may check for the Windows Terminal update in Microsoft Store. Open Microsoft Store*, click "Library" in the lower left corner, then you will see the installed applications, click "Get updates" to see if there are any available update, and click the "Update" button on the right to update.*

    Both devices are running Windows 10. Terminal is already default as seen in the screenshot. Going to Options in PowerShell also showed that using legacy console was already disabled, There are no updates for Windows Terminal. No luck.

    0 comments No comments
  5. Anonymous
    2023-09-28T05:37:59+00:00

    Hello kanishknishar,

    Good to see you in Microsoft Community.

    Is your desktop and laptop both running Windows 10? Since in Windows 11, Command Prompt and PowerShell by default open with Windows Terminal. However, in Windows 10, Windows Terminal is not included as part of the system by default and needs to be manually installed, and some functionalities might differ from Windows 11.

    Or you may disable the Legacy Console mode. Right-click on the PowerShell title bar and choose the Properties menu option. Choose the first tab, Options. Then uncheck the box at the bottom of the page describing Use legacy console. Press the OK button to apply.

    Meanwhile, you may check for the Windows Terminal update in Microsoft Store. Open Microsoft Store*, click "Library" in the lower left corner, then you will see the installed applications, click "Get updates" to see if there are any available update, and click the "Update" button on the right to update.*

    If anything is unclear, please do not hesitate to let me know.

    Best Regards,

    Mosken_L - MSFT | Microsoft Community Support Specialist

    0 comments No comments