人気ブログランキング | 話題のタグを見る
mytips.exblog.jp ブログトップ

Windows PowerShell ファイル読み書き(文字列をMD5で変換)
隠しておきたい文字列を加工する。
MD5変換を、Windows PC上で行う方法。(Win8)
初めてWindows Shellを使ってみた。

スクリプトファイルの実行に制限が掛かっているので、管理者モードでシェルを起動して制限を変更
Set-ExecutionPolicy RemoteSigned


in.txt : 文字列が複数行にわたって書いてあるファイル。
out.txt : 書き出し対象のファイル。
$f = (Get-Content in.txt) -as [string[]]
$i=1
foreach ($txt in $f) {
 $data = [System.Text.Encoding]::ASCII.GetBytes($txt)
 $md5 = [System.Security.Cryptography.MD5]::create()
 $hash = $md5.ComputeHash($data)
 $result =[System.BitConverter]::ToString($hash).ToLower().Replace("-", "")

# ターゲットファイルに書き出す(追記モード)
Add-Content out.txt $result 
 
# シェルへ出力
#Write-Host $i : $l

$i++
}


by sato025 | 2015-02-03 16:28


by fd


var gaJsHost = (("https:" == doc ument.loc ation.protocol) ? "https://ssl." : "http://www.");doc ument.write(unesc ape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));var pageTracker = _gat._getTracker("UA-103429-5");pageTracker._trackPageview();