Microsoft.PowerShell_profile.ps1
程序员文章站
2022-06-03 22:45:08
...
# .$profile # reload profile
# Set-ExecutionPolicy RemoteSigned -Scope LocalMachine # Permits profiles (.ps1)
# $PROFILE | Format-List * -Force
# $PROFILE.CurrentUserAllHosts
##########################################
function prompt
{
# $un = [Regex]::Match($CurrentUser.Name,"SOLIDWORKS\\+(.*)").Groups[1].Value
# $hn = [Net.DNS]::GetHostName()
# $host.ui.rawui.WindowTitle = $un + "@" + $hn #+ " Line: " + $host.UI.RawUI.CursorPosition.Y
# Write-Host($un + "@" + $hn + " ") -foregroundcolor Green -nonewline; Write-Host ($(get-location)) -foregroundcolor Yellow -nonewline
# Write-Host(">") -nonewline -foregroundcolor Green
$host.ui.rawui.WindowTitle = "$(Get-Location)"
# (Get-Date).ToLongTimeString()
# (Get-Date -UFormat %m%d_%H:%M:%S)
Write-Host ("PS " + $(get-location) + "[" + (Get-Date -UFormat %H:%M:%S) + "]" + ">") -foregroundcolor Green -nonewline
return " "
}
# $Shell.WindowTitle= " SysadminGeek"
$Shell = $Host.UI.RawUI
$size = $Shell.WindowSize
$size.width=120
$size.height=36
$Shell.WindowSize = $size
$size = $Shell.BufferSize
$size.width=120
$size.height=9999
$Shell.BufferSize = $size
$shell.BackgroundColor = "Black"
$shell.ForegroundColor = "White"
# New-Item -Force alias:np -value C:\Windows\System32\notepad.exe
Set-Alias ll Get-ChildItem
Set-Alias np C:\Windows\System32\notepad.exe
#env:path += ";C:\emacs"
# Clear-Host
### Tips
# Get-FileHash -Algorithm MD5 filename
# Test-Path $profile
# New-Item -path $profile -type file –force