Hello,
Thank you for posting in Q&A forum.
The problem you are experiencing may be caused by system file corruption or other software conflicts. Here are some possible solutions:
Run the DISM tool: Open a command prompt (with administrator privileges) and run the following command: DISM/Online/Cleanup Image/RestoreHealth. This will scan and repair any damage in the system image.
Re register CMD and PowerShell: Run the following command from the command prompt or PowerShell: sfc/scannow. This will scan system files and attempt to repair any damaged files.
Check for third-party software conflicts: Temporarily disable all third-party antivirus and security software, and try reopening CMD or PowerShell. If the problem is resolved, enable third-party software one by one to determine if there are any conflicts related to it.
Create a new user account: Create a new local user account and try logging in and opening CMD or PowerShell using that account to see if the same problem still occurs.
System Restore: If none of the above methods are effective, you can try using System Restore to restore the system to a state where there were no issues before.
Hope this answer can help you well.
Best regards,
Jill Zhou