Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Powershell Configuration ====== List environment variables <code> gci env: </code> To get $path variable <code> $env:path </code> To edit Powershell profile <code powershell> notepad $PROFILE </code> Dot (.) source to reload $PROFILE into current sessions, just like Bash <code powerhell> . $profile </code> Get path to command history file <code powershell> (Get-PSReadlineOption).HistorySavePath </code> === Reference Config === <code powershell> $env:Path += ";c:\od\scripts" $od = "$home\OneDrive" Import-Module posh-git Import-Module oh-my-posh Set-PoshPrompt -Theme mg $host.PrivateData.ErrorForegroundColor = 'Cyan' $host.PrivateData.ErrorBackgroundColor = 'Black' set-alias exp explorer.exe set-alias gs git-save set-alias gd git-dump set-alias mgi c:\od\scripts\git-init.ps1 set-alias npp notepad++.exe Set-PSReadLineOption -HistoryNoDuplicates function npw() { param( [Parameter(Position=0)] $folder ) Start-Process notepad++.exe -ArgumentList "-openFoldersAsWorkspace $folder" } 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 hpp { Start-Process notepad++.exe (Get-PSReadlineOption).HistorySavePath } 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 } </code> powershell_configuration.txt Last modified: 2022/04/08 12:54by mgupton