Home > OS >  Python script is not executed from my batch file
Python script is not executed from my batch file

Time:05-26

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

CodePudding user response:

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

CodePudding user response:

Thank you so much, adding an call before was enough.

If i have the batch-file and the python script at the same level, with this is enough:

call conda activate

call py Seguridad_Python.py

  • Related