每次你激活一个虚拟环境时,它会在cmd或powershell上显示名称。我想删除它或只是不显示它。有什么办法吗?示例:example我搜索了超过2天的每一种语言,我没有找到。
col17t5w1#
你必须定义一个新的prompt函数来覆盖你当前的函数。
function prompt { $identity = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = [Security.Principal.WindowsPrincipal] $identity $adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator $(if (Test-Path variable:/PSDebugContext) { '[DBG]: ' } elseif($principal.IsInRole($adminRole)) { "[ADMIN]: " } else { '' } ) + 'PS ' + $(Get-Location) + $(if ($NestedPromptLevel -ge 1) { '>>' }) + '> ' }
如果您以管理员身份运行ps,它将给出类似[ADMIN]: PS C:\ps-test>提示,否则将给出PS C:\ps-test>提示。如果您喜欢不同类型的提示符,我建议您查看该文档。
[ADMIN]: PS C:\ps-test>
PS C:\ps-test>
1条答案
按热度按时间col17t5w1#
你必须定义一个新的prompt函数来覆盖你当前的函数。
如果您以管理员身份运行ps,它将给出类似
[ADMIN]: PS C:\ps-test>
提示,否则将给出PS C:\ps-test>
提示。如果您喜欢不同类型的提示符,我建议您查看该文档。