2011-08-31
■[PowerShell]プログラム実行回数

▼ countInvoke.ps1
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{CEBFF5CD-ACE2-4F4F-9178-9926F41749EA}\Count"
#▼ $regPathのプロパティ
$iProp = Get-ItemProperty $regPath
#▼ $regPathの名前んとこ全部
$iName = (Get-Item $regPath).Property
#▼ ROT13変換
Function func($x) {
$conv13 = $x.ToCharArray() | %{
if ( $_ -match "[a-m]") {
[char]([byte][char]$_+13)
}elseif ( $_ -match "[n-z]") {
[char]([byte][char]$_-13)
}else{
$_
}
}
Split-Path -Leaf ([String]$conv13 -replace " ")
}
$iName | %{
$count = $iProp.$_[4]
if ($count -ne 0){
"{0}回 {1}" -f $count, (func $_)
}
}
コメント
