简体   繁体   中英

After adding Python to my windows PATH Powershell stopped recognizing simple commands like cmd and help. Does anyone know how to fix this?

I added Python to my Windows path so that I could use the pip and pyinstaller commands, now commands like cmd, py, and even the 'help' command aren't recognized by Powershell. Trying to use these commands results in the "cmd : The term 'cmd' is not recognized as the name of a cmdlet, function, script file, or operable program." error. I am an amateur developer and I am still very new to programming and file management, I don't know what caused this but I suspect it may have to do with adding Python to the windows PATH. I've looked all over the internet and tried everything I found, nothing seems to work. As I have already said, I am very new to all of this and I am almost certain that I am omitting at least some relevant information but I don't know what else you might need to help me, so I am happy to provide any additional information as needed.

ex. When trying the 'help' command in Powershell, Powershell seems to recognize it as 'more.com', so it would seem that Powershell recognizes the 'help' alias but doesn't know what it's supposed to do.

PS C:\Users\julien> help
more.com : The term 'more.com' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:9 char:19
+ } else { $input | more.com }
+                   ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (more.com:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

edit: As per the advice of JosefZ I ran the echo [%path:;=]&echo.[%] command in PS, I don't how to interpret this, but this is what it gave me:

[C:\Users\julie\AppData\Local\Programs\Python\Python39]
[C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts]
[C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts\]
[C:\Users\julie\AppData\Local\Programs\Python\Python39\]
[]

To address Lee_Dailey I ran your $env:Path -split ';' command as well and was given an identical output, just to make sure i'm not missing something important though, here are the results:

C:\Users\julie\AppData\Local\Programs\Python\Python39
C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts
C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts\
C:\Users\julie\AppData\Local\Programs\Python\Python39\

Like I said, I don't really know how to interpret any of this, hopefully someone smarter than me can translate this to me and explain how to fix whatever I broke. Thanks for the help!

you replaced your path instead of adding to it . [ grin ]

here is my path list. you can use it to rebuild yours ...

C:\Python39\Scripts\
C:\Python39\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\Microsoft VS Code\bin
C:\Program Files\Calibre2\
C:\Program Files\Prio
C:\ProgramData\chocolatey\bin
C:\Program Files\PowerShell\7\
C:\Program Files\Git\cmd
C:\Users\MyUserName\AppData\Local\Microsoft\WindowsApps  

just remember to leave off things that are not on your setup. i suspect you won't have Prio or Calibre . [ grin ]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM