Python Forum
Using a .bat file to execute simple anaconda commands in Windows 10
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using a .bat file to execute simple anaconda commands in Windows 10
#1
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Possible to execute a python script before log off/shutdown with input commands? Kaltex 1 665 May-18-2021, 06:31 AM
Last Post: Skaperen
  Simple plotting from txt file Laplace12 2 875 Aug-23-2020, 09:58 AM
Last Post: Laplace12
  [split] SyntaxError when trying to execute code on Windows nehaya 2 829 Aug-04-2020, 11:18 AM
Last Post: nehaya
  SyntaxError when trying to execute code on Windows Fred0n 2 1,224 Apr-25-2020, 04:30 AM
Last Post: buran
  How to assess elapsed time to execute a .exe file or opening a desktop application? Sudershan 2 1,105 Apr-18-2020, 01:40 PM
Last Post: buran
  Simple Read File Issue blackjesus24 4 1,286 Feb-09-2020, 12:07 AM
Last Post: blackjesus24
  How to use subprocess send commands to windows shell hlhp 3 2,332 Nov-26-2019, 04:40 AM
Last Post: LeanbridgeTech
  Execute .sql file in python pradeepkumarbe 3 10,810 Nov-05-2019, 08:55 AM
Last Post: MckJohan
  Read CSV file into MySQL and use executemany instead of execute bluethundr 1 2,703 May-04-2019, 07:35 AM
Last Post: MvGulik
  Looking for simple help - text file stripping DerekK 1 1,061 Mar-08-2019, 10:06 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020