命令提示符到 bat

command prompt to bat

如何将这组命令提示行转换为 BAT 文件,以便其他人可以快速重新运行它

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

它没有更改目录,所以找不到 activate

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

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

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

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

U: Personal Folders\xxx>PAUSE
Press any key to continue . . .
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

应该可以。 pushd 将当前目录入栈并切换到目标目录。

popd returns到原目录

已根据@mofi 的评论修复。我对 pip 也一无所知 - 自 CP/M 天以来我就没用过它。