I want to run the Windows (Command Prompt) equivalent of

source myvenv/bin/activate

so as to activate and enter into my virtual environment.

  • Batch file can automate what you want, but you need to know what activate does, and translate it accordingly.
    – Darius
    May 23, 2018 at 11:30
  • Well I do not have any idea how to do this :/
    – blank_mind
    May 23, 2018 at 11:32
  • If you have solved the problem, please post your answer as an answer in the “Your Answer” box (below). May 23, 2018 at 19:01

5 Answers 5


At CMD prompt,it worked by running

  • Given this self-answer, the asker appears to be using vanilla Python and virtual environments created with python -m venv some-environment (rather than, say, using conda). May 24, 2018 at 20:15
  • Specific to your question "What is the alternative for source command in cmd?" The equivalent command to "source" is "call".. but it is only used from another batch file. May 14, 2019 at 16:01
  • 1
    "The system cannot find the path specified." - not helpful. Aug 11, 2022 at 21:55

For activating an environment:

activate myenv

for deactivating (all)

  • 1
    not working says 'activate' not a recognized command
    – blank_mind
    May 23, 2018 at 11:35
  • Did you used conda for creating your environments? Try the command conda from your cmd window.
    – MarianD
    May 23, 2018 at 11:50

Go to the the directory where you have the ".bat" file by executing this command:

C:\Users\MyName\Desktop\ProjectsWork\FlaskApplication> cd env\Scripts

Then just call the ".bat" file

\Desktop\ProjectsWork\FlaskApplication\env\Scripts> activate.bat

(env) C:\Users\MyName\Desktop\ProjectsWork\FlaskApplication\env\Scripts>

  • this is the most straightforward and correct answer...thanks!
    – Todd Vance
    Jan 16, 2023 at 22:42

If you want to use your environment in batch file then

call C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3

All the following command will be executed in virtual environment


If you want to activate your virtual environment after running:

virtualenv env  

Just run:


This command will provide you the correct path and the command "source" is not necessary.

Example Image

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .