Select to view content in your preferred language

Fire up python command prompt in custom directory

565
2
07-05-2023 09:15 AM
TylerT
by
Occasional Contributor III

Hello,

ArcGIS Pro installs a Python Command Prompt shortcut in startup which is handy.  Launching it results in a command line that looks like this:

TylerT_0-1688573137845.png

with the arcgispro-py3 environment and the directory shown.  What is the best procedure for modifying the startup to default to a different directory, say...c:\temp for example instead of C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3?  I peaked inside the batch (bat) files associated with the shortcut and saw nothing obvious to a person illiterate in batch language, and did not want to break anything, so could use some help. 

Thank you,

Tyler

ArcGIS Pro 3.1.0

0 Kudos
2 Replies
Luke_Pinner
MVP Regular Contributor

You could create your own shortcut that calls C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\proenv.bat and set the shortcut start in directory to whatever you want.

0 Kudos
by Anonymous User
Not applicable

You'll need to set the path to two files for ArcGIS pro's conda-

 

@echo off

REM Temporarily set the paths to esri's conda 
SET PATH=%PATH%;C:\Program Files\ArcGIS\Pro\bin\Python\Scripts;C:\Program Files\ArcGIS\Pro\bin\Python\condabin

REM Replace "your_env_name" with the name of your Conda environment
CALL conda.bat activate your_env_name

REM Change the path to the folder you want to start in
cd %USERPROFILE%\Documents

REM Add any Python script execution or other commands you want to run after activating the environment and changing the directory.

cmd.exe /k

 

 

0 Kudos