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


Messages In This Thread
Using a .bat file to execute simple anaconda commands in Windows 10 - by gacg1 - Nov-30-2020, 03:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Failed to execute child process (No such file or directory) uriel 1 1,616 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  How To Set Up And Execute A Python File knight2000 4 1,825 May-31-2022, 10:02 AM
Last Post: Larz60+
  execute commands inside a running application mr_byte31 3 1,294 Apr-12-2022, 08:50 AM
Last Post: Larz60+
  batch file for running python scipt in Windows shell MaartenRo 2 1,825 Jan-21-2022, 02:36 PM
Last Post: MaartenRo
  Possible to execute a python script before log off/shutdown with input commands? Kaltex 1 2,235 May-18-2021, 06:31 AM
Last Post: Skaperen
  Simple plotting from txt file Laplace12 2 2,234 Aug-23-2020, 09:58 AM
Last Post: Laplace12
  [split] SyntaxError when trying to execute code on Windows nehaya 2 1,962 Aug-04-2020, 11:18 AM
Last Post: nehaya
  SyntaxError when trying to execute code on Windows Fred0n 2 2,400 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 2,096 Apr-18-2020, 01:40 PM
Last Post: buran
  Simple Read File Issue blackjesus24 4 2,688 Feb-09-2020, 12:07 AM
Last Post: blackjesus24

Forum Jump:

User Panel Messages

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