hxfile
function crypt{
param($file)
if(!$here){$here = $PSScriptRoot}
if(!$here){$here = (Get-Location).path}
$Psm1File = get-content -path $file -Raw
$Psm1Fileext = '.' + $file.split('.')[-1]
$Psm2FilePath = $file.replace($Psm1Fileext,'.TMP')
$sourceFilePath = $file.replace($Psm1Fileext,'-tmp.TMP')
$sourceDatas = $Psm1File.replace("`t","[tab]")
$sourceDatas = $sourceDatas.replace(' ',"[space]")
$sourceDatas = $sourceDatas.replace("`r`n","[retouràlaligne]")
$sourceDatas = $sourceDatas.replace("`n","[retouràlaligne]")
$sourceDatas > $sourceFilePath
$fileBytes = [System.IO.File]::ReadAllBytes($sourceFilePath)
$hexString = -join ($fileBytes | ForEach-Object { "{0:X2}" -f $_ })
$export = $hexString.replace('00','z')
[System.IO.File]::WriteAllText($Psm2FilePath, $export)
cmd /c "del /F /Q $sourceFilePath"
}
crypt -file "<file path>"
/image%2F0881799%2F20140610%2Fob_a8c7fe_logo2.jpg)
Commenter cet article