<SampleIO.PS1>
$dlgOP = New-Object System.Windows.Forms.OpenFileDialog
$dlgSV = New-Object System.Windows.Forms.SaveFileDialog
$RC_Open = $dlgOP.ShowDialog()
$dlgSV.FileName = "aaa001.txt"
$RC_Save = $dlgSV.ShowDialog()
if(($RC_Open -eq 1) -and ($RC_Save -eq 1)){
$path_IN = $dlgOP.FileName
$path_Out = $dlgSV.FileName
$oSR = New-Object System.IO.StreamReader $path_IN , ([System.Text.Encoding]::GetEncoding("Shift_JIS"))
$oSW = New-Object System.IO.StreamWriter $path_OUT , False ,([System.Text.Encoding]::GetEncoding("UTF-8"))
while($oSR.Peek() -ne -1){
$oSW.WriteLine($oSR.ReadLine())
}
$oSR.Close()
$oSW.Close()
}
<20161129sta>
現場では、ps1ファイルの実行は大抵ふさがれているので、
Windows PowerShell ISE のコマンドウィンドウに貼り付けて実行
思い切りバグってました。Vistaで動くので、多分7でも大丈夫なはず
<20161129end>