0

How do I convert this set of command prompt lines to a BAT file so it can quickly be rerun by others

cd "C:\Program Files\Alteryx\bin\Miniconda3\Scripts"  
activate DesignerBaseTools_vEnv

cd "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_vEnv\Scripts" 
pip install py-geohex3

It doesn't change the directory so then can't find activate

U:\11 Personal Folders\xxx>cd "C:\Program Files\Alteryx\bin\Miniconda3\Scripts"

U:\11 Personal Folders\xxx>activate DesignerBaseTools_vEnv
'activate' is not recognized as an internal or external command,
operable program or batch file.

U:\11 Personal Folders\xxx>cd "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_vEnv\Scripts"

U:\11 Personal Folders\xxx>pip install py-geohex3
'pip' is not recognized as an internal or external command,
operable program or batch file.

U:\11 Personal Folders\xxx>PAUSE
Press any key to continue . . .
Quixotic22
  • 2,894
  • 1
  • 6
  • 14
  • I would not be surprised when the file `activate` in the directory `C:\Program Files\Alteryx\bin\Miniconda3\Scripts` has the file extension `.bat` or `.cmd`. Therefore needed as second line is `call activate.bat DesignerBaseTools_vEnv` or `call activate.cmd DesignerBaseTools_vEnv`. See [this answer](https://stackoverflow.com/a/24725044/3074564) for details on how to run a batch file from within a batch file. I strongly recommend to find out the file extension of the file `pip` and use the appropriate command line, i.e. `call` on `pip.bat` or `pip.cmd`, or `pip.exe` for an executable. – Mofi Apr 08 '22 at 20:46

1 Answers1

2
pushd "C:\Program Files\Alteryx\bin\Miniconda3\Scripts"  
CALL activate DesignerBaseTools_vEnv
popd

pushd "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_vEnv\Scripts" 
pip install py-geohex3
popd

should work. pushd pushes the current directory to a stack and switches to the target directory.

popd returns to the original directory.

Fixed in view of @mofi's comment. I'm also in the dark about pip - I've not used it since the CP/M days.

Magoo
  • 77,302
  • 8
  • 62
  • 84