Powershell配置文件
###第一步,安装Powershell 在microsoft store 里面安装Powershell,不要用microsoft powershell,后者是电脑自带的。
第二步,安装一个终端的编辑器
比如nano,vim,这两个在Linux上用的比较多,但是Windows上比较复杂,而且有学习成本,这里推荐一个
GitHub开源的编辑器,micro,他的快捷键都是Windows的标准,没有入门的门槛。项目地址:GitHub micro 链接
打开powershell,输入micro -mkparents true $profile
随便输入一个东西,比如#xxx然后ctrl+s保存。
本人用的配置文件分享
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
}