title: base64decode a file encoded with unix base64
body: <p>I'm not into powershell coding (prefer python ed.).
  Although I need a script to change a base64 file created on unix back to binairy:</p>
  
  <pre><code>echo notepad.exe | base64 &gt; exe.b64
  </code></pre>
  
  <p>I've managed to write some code today on the fly that stripped the '\r\n' from the end but I couldn't get te result to file. It would always print integers to file instead of binary. Likely some of the experienced admins here can do this in a oneliner.</p>
  
  <p>I'm looking for somthing that would run as:</p>
  
  <pre><code>b64_2bin.ps exe.b43 notepad.exe
  </code></pre>
  
  <p>and give me back the original notepad.exe</p>
  
  <p>===
  Anser 1 seems correct:</p>
  
  <p>I dragged the notepad.exe from a windows VMWare guest to my Linux desktop.
  There I ran:</p>
  
  <pre><code>cat notepad.exe | base64 &gt; notepad.b64
  
  
  head notepad.b64 
  TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  AAAA4AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1v
  ZGUuDQ0KJAAAAAAAAACyvsJi9t+sMfbfrDH236wx/6c5MfXfrDH/pz8x69+sMfbfrTEA36wx/6cv
  MenfrDH/pygx9N+sMf+nODH336wx/6c9MfffrDFSaWNo9t+sMQAAAAAAAAAAAAAAAAAAAABQRQAA
  TAEEAA/GW0oAAAAAAAAAAOAAAgELAQkAAKgAAAAkAgAAAAAAiTYAAAAQAAAAwAAAAAAAAQAQAAAA
  AgAABgABAAYAAQAGAAEAAAAAAAAAAwAABAAAQZcDAAIAQIEAAAQAABABAAAAEAAAEAAAAAAAABAA
  AAAAAAAAAAAAAEigAAAsAQAAAPAAAGDxAQAAAAAAAAAAAAAAAAAAAAAAAPACADQOAAAstgAAOAAA
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFhtAABAAAAAeAIAACgBAAAAEAAAAAQAAAAAAAAAAAAA
  AAAAAAAAAAAAAAAAAAAAAC50ZXh0AAAAjKYAAAAQAAAAqAAAAAQAAAAAAAAAAAAAAAAAACAAAGAu
  ZGF0YQAAAGQhAAAAwAAAABAAAACsAAAAAAAAAAAAAAAAAABAAADALnJzcmMAAABg8QEAAPAAAADy
  </code></pre>
  
  <p>I drag notepad.b64 back to the windows 7 desktop and run the command:</p>
  
  <pre><code>[System.Convert]::FromBase64String((Get-Content .\notepad.b64)) | Set-Content -Encoding Byte .\notepad2.exe
  </code></pre>
  
  <p>and that just works. thanks! md5 sum same as original file!</p>