Is there a Windows 10 PowerShell equivalent to .bashrc for Linux Bash?
To view a profile path, display the value of the $PROFILE
variable. You can also use the $PROFILE
variable in a command to represent a path.
%HOMEPATH%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Import-Module DirColors
Import-Module posh-git # 引入 posh-git
Import-Module oh-my-posh # 引入 oh-my-posh
#Set-Theme Paradox 设置主题为 Paradox
Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录
Set-PSReadlineKeyHandler -Key Tab -Function Complete # 设置 Tab 键补全
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete # 设置 Ctrl+d 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward # 设置向下键为前向搜索历史纪录
Set-PSReadLineOption -Colors @{ InlinePrediction = '#DF6C75'}
Invoke-Expression (&starship init powershell)
function Pro {notepad $PROFILE}
function Get-CmdletAlias ($cmdletname) {
Get-Alias |
Where-Object -FilterScript {$_.Definition -like "$cmdletname"} |
Format-Table -Property Definition, Name -AutoSize
}
$env:TEMP="E:\\Temp"
$env:TMP="E:\\Temp"
Write-Host "Hi Mike, welcome back!"
$HOMEDRIVE = "E:"
$HOMEPATH = "\\PowerShell"
Remove-Variable -Force HOME
#Set-Variable HOME "E:\\PowerShell"
# Set and force overwrite of the $HOME variable
Set-Variable HOME "$HOMEDRIVE$HOMEPATH" -Force
# Set the "~" shortcut value for the FileSystem provider
(get-psprovider 'FileSystem').Home = $HOMEDRIVE + $HOMEPATH
Set-location E:\\PowerShell
Function Format-FileSize() {
Param ([int64]$size)
If ($size -gt 1TB) {[string]::Format("{0:0.00} TB", $size / 1TB)}
ElseIf ($size -gt 1GB) {[string]::Format("{0:0.00} GB", $size / 1GB)}
ElseIf ($size -gt 1MB) {[string]::Format("{0:0.00} MB", $size / 1MB)}
ElseIf ($size -gt 1KB) {[string]::Format("{0:0.00} kB", $size / 1KB)}
ElseIf ($size -gt 0) {[string]::Format("{0:0.00} B", $size)}
Else {""}
}
dir env:
Win32-OpenSSH they go to %USERPROFILE%\\.ssh
.
That typically is: