キャリッジリターン( `r)&改行文字(` n)をXMLファイルから削除するにはヘルプが必要です。 1PowershellスクリプトでXMLファイルからキャリッジリターンと改行を削除する
入力ファイル形式
<File1>
<SubFile1> </SubFile1>
<SubFile2> </SubFile2>
<SubFile3> </SubFile3>
.........
<SubFilen> </SubFilen>
</File1>
コードが
$content = [IO.File]::ReadAllText($input_File)
$content = $content.Replace("`r","")
$content = $content.Replace("`n","")
[system.io.file]::WriteAllText($Output_File,$content)
を使用:行の600メガバイト
番号:私はエラー
ファイルのサイズをSystem.OutOfMemoryExceptionにを取得しています
Get-Content
私はMaxMemoryPerShellMB
1024、2048、4096が、運と試みました。
'(ゲット・コンテンツを\ file.xml。)私はPowerShellのプロンプトから実行した場合、私はすべてのエラーを取得していないよ –
を-join'''。 「C:\ Windows \ syswow64 \ Windowspowershell \ v1.0 \ Powershell.exe」のように実行しようとするとエラーが発生します。「C:\ Temp \ File_Encoding.ps1」 noprofile -executionpolicy bypass -File "C:\ Temp \ Change_File_Encoding.ps1" "input.xml" "output.xml" – Praveen