Extending Jeremy's answer:
You need to use call for the "activ.bat" script, as well as for any subsequent commands related to Anaconda / Python. Otherwise, the prompt will end immediately after running the commands, even if you use the pause statement. Please see below for an example:
set root=C:\Users\john.doe\AppData\Local\Continuum\anaconda3 call %root%\Scripts\activate.bat %root% call conda list pandas pause
source share