![]() ![]() Using Set-Content cmdlet, it out base64 encoded file content to file at the specified location.Ĭool Tip: How to find large size files in PowerShell! PowerShell Base64 Encode String $fileContentEncoded – contains base64 encode file content using ToBase64String() method which accepts $fileContentsInBytes parameter and convert file to base64. $fileContentInBytes – contains bytes about file content, get it using UTF8.GetBytes() method $FileContent – contains content of file using Get-Content cmdlet In the above PowerShell script to base64 encode file, ![]() Write-Host $FileName ".b64" "File Encoded Successfully!" $fileContentEncoded | Set-content ($fileName ".b64") ![]() # Save Base64 Enconde file with extension. $fileContentEncoded = ::ToBase64String($fileContentInBytes) $fileContentInBytes = ::UTF8.GetBytes($FileContent) #Get the bytes of the file content with encode $FileName = "D:\Logs-FTP01\EncodeLogic.txt" PowerShell base64 encode the file contents and save file to location with. ![]() Use PowerShell script to take a file as input, read the contents of the file using Get-Content cmdlet. 5 Conclusion PowerShell Base64 Encode File Content ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |