Python Forum

Full Version: Using a .bat file to execute simple anaconda commands in Windows 10
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?