June 27th, 2013, 12:24 PM
Powershell help - remove line break - 0D 0A
I'm posting in here because I saw another thread saying this was the right place to post powershell questions.
I have a script that generates a hash variable. I want to use the hash for a password for something. The hash out puts to a text file and also to the clip board.
I want to use the clipboard to paste the variable into another application. The problem is that the clipboard also includes the termination string 0D0A. I just want the text for the hash in the clipboard nothing else. How do I remove it? I've tried a few things now this is my current version just trying to remove the 0D.
$hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($MAC))) -replace "\w\x0D\w", ''
$hash | Out-File $Env:USERPROFILE\Desktop\Use_This_To_Encrypt_Your_Backup.txt #-Append
$hash | clip
Thanks in advance,
Tags for this Thread
Click Here to Expand Forum to Full Width