在 Windows 终端内将别名设置为 Anaconda 提示符
Setting up alias into Anaconda prompt inside Windows Terminal
运行 windows 终端内的 anaconda 总是将我指向 (base) C:\WINDOWS\system32>
,然后我必须将 tru 目录导航到我的目标目录。
如何在 windows 终端内的 anaconda 提示符中添加别名?
Win Terminal 的小箭头内是一个 Settings
按钮。在那里你可以打开 settings.json
- 在这个文件中你可能 运行 你的 anaconda 使用如下命令:
"commandline": "cmd.exe /K C:\Users\Home\anaconda3\Scripts\activate.bat"
那么如果你打开activate.bat
文件,你可以添加DOSKEY
s。
示例:
@REM Copyright (C) 2012 Anaconda, Inc
@REM SPDX-License-Identifier: BSD-3-Clause
@REM Test first character and last character of %1 to see if first character is a "
@REM but the last character isn't.
@REM This was a bug as described in https://github.com/ContinuumIO/menuinst/issues/60
@REM When Anaconda Prompt has the form
@REM %windir%\system32\cmd.exe "/K" "C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3"
@REM Rather than the correct
@REM %windir%\system32\cmd.exe /K ""C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3""
@REM this solution taken from
@set "_args1=%1"
@set _args1_first=%_args1:~0,1%
@set _args1_last=%_args1:~-1%
@set _args1_first=%_args1_first:"=+%
@set _args1_last=%_args1_last:"=+%
@set _args1=
@REM Here you can add your aliases
doskey cdp=cd C:\Users\Home\Desktop\Porn
doskey cdg=cd C:\Users\Home\Documents\GitHub\
cls
@if "%_args1_first%"=="+" if NOT "%_args1_last%"=="+" (
@CALL "%~dp0..\condabin\conda.bat" activate
@GOTO :End
)
@REM This may work if there are spaces in anything in %*
@CALL "%~dp0..\condabin\conda.bat" activate %*
:End
@set _args1_first=
@set _args1_last=
cls
就是之后清零的命令
运行 windows 终端内的 anaconda 总是将我指向 (base) C:\WINDOWS\system32>
,然后我必须将 tru 目录导航到我的目标目录。
如何在 windows 终端内的 anaconda 提示符中添加别名?
Win Terminal 的小箭头内是一个 Settings
按钮。在那里你可以打开 settings.json
- 在这个文件中你可能 运行 你的 anaconda 使用如下命令:
"commandline": "cmd.exe /K C:\Users\Home\anaconda3\Scripts\activate.bat"
那么如果你打开activate.bat
文件,你可以添加DOSKEY
s。
示例:
@REM Copyright (C) 2012 Anaconda, Inc
@REM SPDX-License-Identifier: BSD-3-Clause
@REM Test first character and last character of %1 to see if first character is a "
@REM but the last character isn't.
@REM This was a bug as described in https://github.com/ContinuumIO/menuinst/issues/60
@REM When Anaconda Prompt has the form
@REM %windir%\system32\cmd.exe "/K" "C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3"
@REM Rather than the correct
@REM %windir%\system32\cmd.exe /K ""C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3""
@REM this solution taken from
@set "_args1=%1"
@set _args1_first=%_args1:~0,1%
@set _args1_last=%_args1:~-1%
@set _args1_first=%_args1_first:"=+%
@set _args1_last=%_args1_last:"=+%
@set _args1=
@REM Here you can add your aliases
doskey cdp=cd C:\Users\Home\Desktop\Porn
doskey cdg=cd C:\Users\Home\Documents\GitHub\
cls
@if "%_args1_first%"=="+" if NOT "%_args1_last%"=="+" (
@CALL "%~dp0..\condabin\conda.bat" activate
@GOTO :End
)
@REM This may work if there are spaces in anything in %*
@CALL "%~dp0..\condabin\conda.bat" activate %*
:End
@set _args1_first=
@set _args1_last=
cls
就是之后清零的命令