Python Forum
How to run script from batch file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run script from batch file?
#1
I have Anaconda on a Windows Server. I would like to run a script at ever start up from Task Scheduler. I've only ever been running my code from Spyder directly. How can I call the script to run and not to open up from a Batch file?

Note: Python isn't seen from the CMD line using python

I'm guessing the Bat file would be something like:

%windir%\System32\cmd.exe "/K" C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3
"python C:\Users\Administrator\Desktop\HelloWorld.py"
Reply
#2
I think I got it. In case it helps anyone else.
 
@echo on call C:\ProgramData\Anaconda3\Scripts\activate.bat
C:\ProgramData\Anaconda3\python.exe "C:\Users\Administrator\Desktop\HelloWorld.py"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,290 Jun-29-2023, 11:57 AM
Last Post: gologica
  batch file for running python scipt in Windows shell MaartenRo 2 1,907 Jan-21-2022, 02:36 PM
Last Post: MaartenRo
  python script to Batch File biprabu 1 2,064 Sep-09-2020, 01:49 PM
Last Post: jefsummers
  Web Form to Python Script to Text File to zip file to web wfsteadman 1 2,151 Aug-09-2020, 02:12 PM
Last Post: snippsat
  changing code to work on a batch of images within a folder Afrodizzyjack 2 2,063 May-12-2020, 08:56 PM
Last Post: Afrodizzyjack
  Batch file not running python script in task scheduler davork 3 4,536 May-09-2019, 12:53 PM
Last Post: Gribouillis
  stiching python and batch jenya56 1 2,537 Apr-02-2019, 06:16 PM
Last Post: micseydel
  script for renaming batch of files rado_789 5 3,340 Nov-07-2018, 02:18 PM
Last Post: rado_789
  Python script batch download and batch rename jkhaksaar 3 3,452 Oct-11-2018, 03:42 PM
Last Post: snippsat
  Concept of batch files Truman 2 2,842 Jul-23-2018, 09:02 PM
Last Post: Truman

Forum Jump:

User Panel Messages

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