Powershell的配置

Powershell配置文件

###第一步,安装Powershell
在microsoft store 里面安装Powershell,不要用microsoft powershell,后者是电脑自带的。

第二步,安装一个终端的编辑器

比如nano,vim,这两个在Linux上用的比较多,但是Windows上比较复杂,而且有学习成本,这里推荐一个
GitHub开源的编辑器,micro,他的快捷键都是Windows的标准,没有入门的门槛。项目地址:GitHub micro 链接
打开powershell,输入micro -mkparents true $profile
随便输入一个东西,比如#xxx然后ctrl+s保存。

本人用的配置文件分享

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Set-Alias getlist ls
Set-Alias cl 'clear'
Set-Alias py python
#打开历史记录
Set-PSReadLineOption -PredictionSource History
#Set-Alias ppip "pip -i http://pypi.doubanio.com/simple/ --trusted-host pyi.doubanio.com"
#Set-Alias pr './pr.ps1'
$mypath="C:/users/ian/ianhome/mypath"
function nnmap([string]$parm){

echo $parm
nmap $parm -O -sS
}
function pr(){
set t "powershell全局代理"
echo $t
$Env:http_proxy="http://127.0.0.1:11223"
$Env:https_proxy="http://127.0.0.1:11223"
$t="代理地址:"
echo $t
echo $Env:http_proxy
echo $Env:https_proxy
}
function nopr(){
echo "终端取消代理..."
$Env:http_proxy=""
$Env:https_proxy=""
}

function ppip([string]$mod,[string]$r){
echo $parm
echo "pip 临时换源安装ing"
$command=""
if($r){
echo "read TXT mode"
$command="pip install -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com -r "+$r
pip install -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com -r $r
}
elseif($mod){
echo "Common Mode"
$command="pip install -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com "+$mod
pip install -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com $mod
}
else{
echo "Error No input module"
echo "Use : ppip xxx OR ppip -r requirements.txt"
}
echo "Used Command: "
echo $command
return
}






Powershell的配置
http://tang895.github.io/2022/09/20/Powershell的配置/
作者
TangYijun
发布于
2022年9月20日
许可协议