Hi 狗蛋 李, I'm Henry. I’d like to share some thoughts on your issue. While I’m unable to reply in your native language, I’ve translated the content to better understand your situation.
Here is a step-by-step guide to diagnose you can refer:
Solution 1: The PowerShell Profile Script
The way to test this is to launch PowerShell while bypassing your profile.
- Press Windows Key + R to open the Run dialog.
- Type the following command and press Enter:
powershell.exe -NoProfile
If PowerShell starts normally and you see a command prompt, we have confirmed the problem is your profile script.
To Fix the Profile Script:
- In the working -NoProfile PowerShell window, type the following command to open your profile script in Notepad:
notepad $PROFILE - Examine the script for any commands that might be causing the freeze.
You can either fix the problematic line or simply rename the file (e.g., from profile.ps1 to profile.ps1.bak) to disable it completely.
Solution 2: If powershell.exe -NoProfile also freezes, then the issue is likely with corrupted system files that PowerShell depends on. You can repair these using built-in Windows tools.
Open Command Prompt as an Administrator.
- First, run the System File Checker to repair Windows files:
-
sfc /scannow
-
- After that completes, run the DISM tool to repair the Windows component store:
-
DISM /Online /Cleanup-Image /RestoreHealth
-
Solution 3: If the problem persists, a third-party application (often an antivirus or security suite) is likely interfering with powershell.exe.
- Boot your computer into Safe Mode with Networking.
- Try to launch PowerShell.
- If PowerShell works correctly in Safe Mode, it confirms that a startup program is the cause. You will need to perform a "clean boot" or temporarily disable your antivirus software to identify the specific application that is causing the conflict.
I hope this information and these keywords help point you in the right direction for your research. Let me know how it goes, and if this answer helps, feel free to hit “Accept Answer” so others can benefit too