powershell $s='Hello, world!';$s[-1..-($s.length)]-join''
Datei:
Weg 1:
powershell $f=[IO.File]::ReadAllBytes('.\file.txt');$t=[Text.Encoding]::ASCII.GetString($f);$t[-1..-($t.length)]-join''
Weg 2:
powershell [void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic');$s=gc .\file.txt;[Microsoft.VisualBasic.Strings]::StrReverse($s)
Byte umgekehrt:
schleppend:
powershell [byte[]]$b=gc '.\file.bin' -En byte;[array]::Reverse($b);[IO.File]::WriteAllBytes('.\Reverse.bin',$b)
schnell:
powershell [byte[]]$b=[IO.File]::ReadAllBytes('.\file.bin');[array]::Reverse($b);[IO.File]::WriteAllBytes('.\Reverse.bin',$b)