Windows PowerShell: changing the command prompt

前端 未结 6 821
渐次进展
渐次进展 2020-11-30 20:27

Using Windows PowerShell, how do I change the command prompt?

For example, the default prompt says

PS C:\\Documents and Settings\\govendes\\My Docume         


        
6条回答
  •  渐次进展
    2020-11-30 21:07

    Related to a comment to Ocaso Protal's answer, the following is needed for Windows Server 2012 as well as Windows 7 (in a PowerShell window):

    new-item -itemtype file -path $profile -force
    notepad $PROFILE
    

    I would suggest the following as a prompt if you run with multiple user names (e.g. yourself + a production login):

    function Global:prompt {"PS [$Env:username]$PWD`n>"} 
    

    (Credit goes to David I. McIntosh for this one.)

提交回复
热议问题