我的powershell和cmd似乎使用不了cmd指令了,如何解决?

电脑中装有powershell 7,使用Windows Terminal,前几天配置过“gcc”和“g++”等指令的环境变量(不清楚是否会有影响)
尝试输入了如下指令

shutdown -s -t 600

无论是powershell 7、cmd还是系统自带powershell(下称powershell),返回的结果都是无法识别
powershell 7结果:

shutdown: The term 'shutdown' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

cmd结果:

'shutdown' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

powershell结果:

shutdown : 无法将“shutdown”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保
路径正确,然后再试一次。
所在位置 行:1 字符: 1

  • shutdown -s -t 600
  • ~~~~~~~~
    • CategoryInfo : ObjectNotFound: (shutdown:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

除此之外还尝试了“schtasks”指令,结果同上
但是输入“g++”的时候识别出来了

g++.exe: fatal error: no input files
compilation terminated.

感觉可能是环境变量的问题,但是自己去看了也排查不出什么

希望问题能够得到解决,非常感谢

你配置的是否是用户环境变量,如果是可以使用管理员打开cmd,然后看看是否好用。如果配置的是系统环境变量,可以将其注释掉,然后重启,看是否好用。