Reputation: 101
I have set the PATH environment variable:
C:\Users\zy>path PATH=e:\ProgramData\Anaconda3;e:\ProgramData\Anaconda3\Library\mingw-w64\bin;e:\ ProgramData\Anaconda3\Library\usr\bin;e:\ProgramData\Anaconda3\Library\bin;e:\Pr ogramData\Anaconda3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\W bem;C:\Windows\System32\WindowsPowerShell\v1.0\;d:\Program Files\Process Lasso\; ;e:\Program Files (x86)\Microsoft VS Code\bin
I can successfully call python by Win+R and cmd, then enter 'python'
but if I call cmd in a directory by shift+right click, it will suggest 'python is not recognized as an internal or external command'
so when I run bat file in a directory, it can not succeed.
@echo off
python
pause
Upvotes: 3
Views: 2186
Reputation: 89
Write this in your .bat file:
@echo off
start python
pause
When it comes to running applications with a batch file, you need to put the start
keyword before writing in the applications path.
If you are still experiencing some trouble, then you should download python installer (corresponding to the version you are using right now) open it and you should see a choice called Modify
. Click on it and make sure you check the box saying Add Python to environment variables
.
Upvotes: 1