2026-04-02 23:12:36 +08:00

29 lines
1.0 KiB
Markdown

---
title: powershell修改提示中文件路径
createTime: 2022/05/18 21:18:57
tags:
- Windows
categories:
- 随记
---
参考[hiding-the-full-file-path-in-a-powershell-command-prompt-in-vscode](https://stackoverflow.com/questions/52107170/hiding-the-full-file-path-in-a-powershell-command-prompt-in-vscode)
1. `test-path $profile` (is there a profile set up?)
2. `new-item -path $profile -itemtype file -force` (assuming the answer to the above is false)
3. `notepad $profile` (opens notepad)
4. paste in (from the SuperUser answer above)
```powershell
function prompt {
$p = Split-Path -leaf -path (Get-Location)
"$p> "
}
```
5. save (you shouldn't have to chose a location, it is already done for you)
> 这里其实直接新开一个 powershell 窗口就可以了
6. reload vscode - you will probably get an error message about running scripts (or just do next step before reload)
7. `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` (at your integrated terminal PS prompt, also from the SuperUser answer)
8. reload vscode