Advertisement
private775

TXT2BIN and BIN2TXT (Base64)

Jul 12th, 2018
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # bin to text
  2. $bytes = [System.IO.File]::ReadAllBytes('C:\temp\file.zip')
  3. $txt = [System.Convert]::ToBase64String($bytes)
  4. [System.IO.File]::WriteAllText('C:\temp\zip.txt', $txt)
  5.  
  6. # text to bin
  7. $tt = [System.IO.File]::ReadAllText('C:\temp\zip.txt')
  8. $bb = [System.Convert]::FromBase64String($tt)
  9. [System.IO.File]::WriteAllBytes('C:\temp\txt.zip', $bb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement