简体   繁体   中英

Python script is not executed from my batch file

I have written the following code within a .bat file, (to execute a python script):

conda activate 
cd OneDrive - My path/Documenti/Python/Seguridad/Remote 
py Seguridad_Python.py

If I execute that command in cmd.exe, the python file is executed.

But, if I run the .bat file with those commands, it opens the Command Prompt window, but does not execute the python script.

Can someone help?

I have also tried it with the next one, (everything in the same line), and it does the same.

C:\ProgramData\Anaconda3\python.exe C:\Users\------ MY PATH --------\\Documenti\Python\Seguridad\Remote\Seguridad_Python.python

Adding a call before was enough.

If I have the batch file and the python script at the same level, this was enough:

call conda activate 

call py Seguridad_Python.py

Maybe you can try as below. Specify the batch file extension in the command prompt. Once you hit enter, it invokes your python script and run the program

C:\Users\------ MY PATH --------\\Documenti\Python\Seguridad\Remote\xyz.bat

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