windows - 在 Windows 终端中将别名设置为 Anaconda 提示符
问题描述
在 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 https://stackoverflow.com/a/31359867
@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
只是之后清除的命令。
推荐阅读
- c++ - LLVM getelementptr:第一个索引的整数类型
- node.js - fs.readFile() 是异步函数吗?
- flutter - 当firestore查询中的条件更新时,flutter-数据不会在流生成器中刷新
- python - 我试图在 discord.py 中创建一个楼梯命令
- c++ - 如何从 rand() 中获取“x”元素?
- javascript - AMP Analytics 未触发要在 Google Analytics 中跟踪的事件
- java - VisualVM java profiling - 自时间执行?
- database - 枚举列laravel 8上的多项选择
- node.js - 如何通过多个 https 域为我的应用程序提供服务
- node.js - 在 NodeJs (Chai) 中监视对依赖项方法的调用