Last active 1757553078

打开Power shell控制台,执行命令:notepad $PROFILE 或 code $PROFILE

Microsoft.PowerShell_profile.ps1 Raw
1Set-Alias -Name ll -Value ls
2Set-Alias -Name pn -Value pnpm
3
4function open {
5 param ($path)
6 if ($path) {
7 explorer.exe $path
8 } else {
9 Write-Output "Please input a path."
10 }
11}
12
13function vvv {
14 open D:\Programs\v2rayN\v2rayN.exe
15}
16
17function 1remote {
18 open D:\Programs\1Remote\1Remote.exe
19}
20
21function proxyset {
22 param ($url)
23
24 $defUrl = "http://127.0.0.1:1080"
25 if ($url) {
26 $defUrl = $url
27 }
28 $env:http_proxy=$defUrl
29 $env:https_proxy=$defUrl
30 Write-Output "proxy is set to: $defUrl"
31}
32
33function proxyclear {
34 $env:http_proxy=""
35 $env:https_proxy=""
36}
37
38function gitproxyset {
39 param ($url)
40
41 $defUrl = "http://127.0.0.1:1080"
42 if ($url) {
43 $defUrl = $url
44 }
45 git config --global http.proxy $defUrl
46 git config --global https.proxy $defUrl
47 Write-Output "git proxy is set to:"
48 git config list --global | findstr proxy
49}
50
51function gitproxyclear {
52 git config --global --unset http.proxy
53 git config --global --unset https.proxy
54 Write-Output "git proxy is unset"
55 git config list --global | findstr proxy
56}
57
58function proxyprint {
59 Write-Output "http_proxy: $env:http_proxy"
60 Write-Output "https_proxy: $env:https_proxy"
61}
62
63function GotoGitrepository {
64 Set-Location D:\GitRepository
65}
66
67function GotoDesktop {
68 Set-Location C:\Users\Administrator\Desktop
69}
70
71# oh-my-posh init pwsh | Invoke-Expression
72# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/quick-term.omp.json" | Invoke-Expression
73# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/takuya.omp.json" | Invoke-Expression
74# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/hunk.omp.json" | Invoke-Expression
75# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_rainbow.omp.json" | Invoke-Expression
76# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/star.omp.json" | Invoke-Expression
77# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/M365Princess.omp.json" | Invoke-Expression
78oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/M365Princess_Re.omp.json" | Invoke-Expression