This is an old revision of the document!
Powershell Configuration
List environment variables
gci env:
To get $path variable
$env:path
To edit Powershell profile
notepad $PROFILE
Example: baseline config
$env:Path += ";c:\od\scripts"
$od = "$home\OneDrive"
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme mg
set-alias exp explorer.exe
Set-PSReadLineOption -HistoryNoDuplicates
function h2 {
notepad (Get-PSReadLineOption | select -ExpandProperty HistorySavePath)
}
function h3 {
code -n (Get-PSReadLineOption | select -ExpandProperty HistorySavePath)
}
function hp {
Get-History |
Out-GridView -Title "Press CTRL, select multiple and Hit OK" -OutputMode Multiple |
ForEach-Object {
Write-Output "PS> $($_.CommandLine)"
Invoke-Expression $($_.CommandLine)
}
}
function git-dump([Parameter(Mandatory=$true)][string]$commit, [Parameter(Mandatory=$true)][string]$path) {
$temp_file="c:\tmp\git-dump.zip"; git archive -o $temp_file $commit; Expand-Archive -path $temp_file -destinationpath $path
}
function git-save {
git add .; git commit
}
function mgl {
git log
}
function git-ls($commit) {
git ls-tree --name-only -r $commit
}
function git-show($commit) {
git show --name-only $commit
}