Share via

How to fix powershell. It opens but need the command line.

Thérèse Fournier 0 Reputation points
2026-03-05T14:33:36.8533333+00:00

Windows powerrshell will not work. it opens but is asking a command line. every command line i put in it is refused by the system

Windows for home | Windows 11 | Performance and system failures
0 comments No comments

3 answers

Sort by: Most helpful
  1. Clary-N 10,395 Reputation points Microsoft External Staff Moderator
    2026-03-06T06:15:36.4+00:00

    Hi Thérèse Fournier,

    Thank you for reaching out to Microsoft Q&A forum. I understand how frustrating it is when PowerShell opens but then refuses every command.

    Based on what you described, PowerShell itself is opening correctly, but something in the Windows environment (such as the terminal host, system path, or system files) may be preventing it from accepting commands properly.

    I can see that Q&A Assist has already shared a few steps. If you’ve tried those and the issue persists, please try the additional steps below:

    Step 1: Repair Windows system files

    When PowerShell opens but refuses commands, it often points to corrupted or missing Windows system components. Repairing them can help restore normal functionality.

    1. Open the Start menu, search for Command Prompt
    2. Right‑click it and select Run as administrator
    3. In the Command Prompt window, run this command:
         DISM /Online /Cleanup-Image /RestoreHealth
      
    4. Please wait for the process to complete (it may pause at certain percentages—this is normal)
    5. Restart your PC once it finishes

    This process is safe and won’t affect your personal files. It repairs Windows components that PowerShell depends on.

    Step 2: Check that PowerShell is enabled in Windows Features

    In some cases, PowerShell can be partially disabled at the system level.

    1. Press Windows + R, type optionalfeatures, then press Enter
    2. In the Windows Features window, make sure Windows PowerShell is checked
    3. If it’s unchecked, enable it and click OK
    4. Restart your PC and test PowerShell again

    Step 3: Perform a clean boot to rule out software conflicts

    Startup apps or security software can sometimes interfere with PowerShell.

    1. Press Windows + R, type msconfig, and press Enter
    2. Under the Services tab, check Hide all Microsoft services, then click Disable all
    3. Go to Startup > Open Task Manager, and disable startup items
    4. Restart your PC and test PowerShell

    *Disclaimer: A "clean boot" starts Windows with a minimal set of drivers and startup programs. It helps to determine whether a background service 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 back on track. 

    If PowerShell works in a clean boot state, something running in the background is likely causing the issue.

    Please let me know what happens after trying these steps, or if you see any specific error messages. I’ll be happy to continue helping you work through this.


    If you have extra questions about this answer, please click "Comment".  

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. IGYQ 18,430 Reputation points Independent Advisor
    2026-03-05T15:08:34.58+00:00

    Hi!

    Welcome to Microsoft Q&A forum.

    Can you give me a bit more information like what command are you trying to execute and what error or message shows up when it fails.

    Can you also verify when was the last time that you used PowerShell without issues.

    0 comments No comments

  3. Q&A Assist
    2026-03-05T14:33:53.0766667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    PowerShell is working as designed when it opens and waits for commands. It always expects valid PowerShell commands; if a command is “refused,” it usually means the command is not recognized or is not valid in PowerShell.

    To get a working command line experience and avoid errors, try these steps:

    1. Open the correct shell
      • Select Start.
      • Type PowerShell or Command Prompt.
      • Choose one of these:
        • Windows PowerShell (classic PowerShell)
        • Windows Terminal (hosts PowerShell and Command Prompt)
      • If Windows Terminal opens and causes issues, switch back to the classic console host:
        1. Select Start > Settings > System > For developers.
        2. Under Terminal, select Windows Console Host.
    2. Test with simple built-in commands In the PowerShell window, type these commands one at a time and press Enter after each:
      • Get-Process
      • Get-Date
      • Get-ChildItem
      These are standard PowerShell cmdlets. If they work, PowerShell is functioning correctly and previous errors were due to invalid or non‑PowerShell commands.
    3. If commands are still “not recognized”
      • Ensure that commands entered are valid PowerShell cmdlets, not commands meant for another tool.
      • If trying to run a specific product’s PowerShell cmdlets (for example, SharePoint Online), the corresponding module must be installed first. When a command is not recognized, it can mean the module is missing or not loaded.
    4. If PowerShell or Command Prompt do not open correctly
      • On Windows 11, console apps (PowerShell, Command Prompt) may open inside Windows Terminal by default. If there are compatibility issues, switch the default host to Windows Console Host as described in step 1.

    If basic built-in commands like Get-Process and Get-Date run successfully, the environment is healthy and only the specific commands being typed need to be corrected or the right modules installed.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.