Python Forum
Using a .bat file to execute simple anaconda commands in Windows 10 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Using a .bat file to execute simple anaconda commands in Windows 10 (/thread-31253.html)



Using a .bat file to execute simple anaconda commands in Windows 10 - gacg1 - Nov-30-2020

Hello everyone!

I'm trying to create a shortcut in Windows 10 to enter anaconda and execute a simple command in a virtual env.

I'm trying with this .bat file:

    echo off
    cls
    "%windir%\System32\cmd.exe" /k ""C:\ProgramData\Anaconda3\Scripts\activate.bat" "C:\ProgramData\Anaconda3" && python "C:\ProgramData\Anaconda3\shortcuts\ledfx\ledfxpy.py""
Where ledfxpy.py contains:

 conda activate ledfx
    ledfx --open-ui
When I execute this .bat file, I get in anaconda CMD, but it gives me this error:

      File "C:\ProgramData\Anaconda3\shortcuts\ledfx\ledfxpy.py", line 1
        conda activate ledfx
              ^
    SyntaxError: invalid syntax
But inside the CMD that is open, if I type

    conda activate ledfx
    ledfx --open-ui
It works like a charm. Any ideas?