2013年11月14日木曜日

URLエンコード、URLデコードをする

関数



実行例

# 実行
PS > Get-URLEncode -VALUE "あいうえお" -ENCODING "utf-8"
%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a
# 実行
PS > Get-URLDecode-VALUE "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a" -ENCODING "utf-8"
あいうえお

メモ

文字コードの指定「Encoding.GetEncoding」


2013年11月3日日曜日

ファイル名を置換する

関数


実行例

$FolderPath = "C:\sample"
$Include = "*.xls"
$Befor = "\["
$After = "【"
Get-ChildItem $FolderPath -Recurse -Include $Include |
ForEach-Object{
  Replace-FileName -FilePath $_.FullName -Befor $Befor -After $After
}