메뉴 건너뛰기

enjoyTools.net

 

function prompt  {  $p = Split-Path -leaf -path (Get-Location)  "$p> " }

 

출처: https://superuser.com/questions/446827/configure-the-windows-powershell-to-display-only-the-current-folder-name-in-the?answertab=active#tab-top

 


위에꺼는 경로가 그냥 다 날라가버리네...;; 밑에걸로 하니까 된다.

이걸 vscode에서 자동으로 뜨게 할려는데 방법을 모르겠다. ㅆ...

 

function prompt {  $host.ui.rawui.WindowTitle = "PS $pwd";  $p = 'PS ' + ($pwd -split '\\')[0]+' '+$(($pwd -split '\\')[-1] -join '\') + '> ';  return $p }

 

출처: https://social.technet.microsoft.com/Forums/lync/en-US/4fb9f6ab-f23b-4a9c-9355-8a778c4a8de4/how-to-make-the-path-shorter-in-the-prompt?forum=winserverpowershell

 


vscode 환경설정에서 아래 내용을 추가한다.

 

"terminal.integrated.shellArgs.windows": ["-ExecutionPolicy","Bypass","-NoLogo","-NoProfile","-NoExit", "-Command", "function prompt {  $host.ui.rawui.WindowTitle = \"PS $pwd\";  $p = $(($pwd -split '\\\\')[-1] -join '\\') + '$ ';  return $p }"]

 

NoExit 옵션 출처: https://github.com/Microsoft/vscode/issues/34019

 

끝.