-
-
Save cd01/6647326 to your computer and use it in GitHub Desktop.
このコマンドレット、この前 PowerShell で実行した、ような・・・・・・ ref: http://qiita.com/cd01/items/1f4a380234ef9ea86d73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Prompt { | |
# PowerShell 3.0+ | |
Export-Csv -Path ~\.posh_history.csv -InputObject (Get-History)[-1] -Append | |
return "$pwd > " | |
} | |
Import-Csv ~\.posh_history.csv | Add-History |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Prompt { | |
# PowerShell 3.0+ | |
Export-Csv -Path ~\.posh_history.csv -InputObject (Get-History)[-1] -Append | |
return "$pwd > " | |
} | |
Import-Csv ~\.posh_history.csv | Add-History |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2.0 向け(PowerShell 2.0 のことは忘れましょう | |
if (-not (Test-Path ~\.posh_history.csv)) { | |
"#TYPE Microsoft.PowerShell.Commands.HistoryInfo" | Out-File ~\.posh_history.csv -encoding UTF8 | |
'"Id","CommandLine","ExecutionStatus","StartExecutionTime","EndExecutionTime"' | Out-File ~\.posh_history.csv -encoding UTF8 -append | |
} | |
$h = (Get-History)[-1] | |
$csv = "`"$($h.Id)`",`"$($h.CommandLine)`",`"$($h.ExecutionStatus)`",`"$($h.StartExecutionTime)`",`"$($h.EndExecutionTime)`"" | |
$csv | Out-File ~\.posh_history.csv -encoding UTF8 -append |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment