The Home windows 10 PowerShell is mainly a configuration administration and activity automation program designed by Microsoft. Nevertheless, it doesn’t imply that you just can not use this program on an working system aside from Home windows. You may simply apply it to the completely different Linux distributions in addition to on macOS. Nevertheless, the one distinction is that it comes pre-installed with Home windows, whereas you’ll have to set up it by your self for the opposite working methods. However, for this specific article, we will likely be utilizing the PowerShell program on Home windows 10.
The Home windows 10 PowerShell program has a command-line shell that consists of some related scripting languages. You may simply write and execute scripts whereas utilizing this program in Home windows 10. Now, when you have got developed a ample understanding of the Home windows 10 PowerShell program, it’s good to get began with the Base64 encoding and decoding in PowerShell.
The way to do Base64 Encoding and Decoding in PowerShell in Home windows 10?
On this part, we’ll clarify the method of performing the Base64 encoding and decoding utilizing the PowerShell program in Home windows 10. For that, you simply must comply with the three easy steps described under:
Step 1: Accessing the Home windows 10 PowerShell
Initially, you’ll have to entry the PowerShell software on Home windows 10. It’s essential find the search part current in your Home windows 10 taskbar and sort “powershell” in it. You may be offered with just a few outcomes from which you could click on on the Home windows PowerShell choice as highlighted within the following picture for launching the PowerShell software on Home windows 10.
We’ve got additionally proven the final interface of the Home windows 10 PowerShell software within the picture under in your comfort. That is what the Home windows 10 PowerShell usually seems to be like.
Step 2: Performing the Base64 Encoding in PowerShell
The Base64 encoding in PowerShell will likely be carried out in three steps. First, we’ll present you these three instructions that will likely be liable for performing the Base64 encoding in PowerShell, after which we’ll clarify them to you one after the other. The next picture exhibits the entire Base64 encoding course of in PowerShell in a single look:
In step one of the Base64 encoding course of, now we have outlined a variable named “TEXT” with the “$TEXT” notation and have assigned a string to it that we need to be encoded. Then, for performing the precise encoding of this string and for holding these outcomes, within the second step, now we have created one other variable “$ENCODED” and equalized it to the assertion “[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($TEXT))”.
On this assertion, the textual content string that we had outlined in step one is transformed into Unicode bytes, after which these Unicode bytes are encoded and saved into the “$ENCODED” variable. Lastly, within the third step, we would like a press release that’s able to printing our encoded string on the PowerShell window. For that, now we have used the assertion “Write-Output $ENCODED.” This assertion will merely print the contents of the “$ENCODED” variable on the PowerShell window.
Some extent to be famous over right here is that each one of those steps will likely be executed one after the other, i.e., you’ll have to press the Enter key after typing each single assertion. Nevertheless, as quickly as you press the Enter key after typing the final assertion, the results of this encoding course of, i.e., our encoded string, will seem on the PowerShell window as proven within the picture under:
Step 3: Performing the Base64 Decoding in PowerShell
Now, for the Base64 decoding in PowerShell in Home windows 10, we’ll carry out the reverse strategy of the Base64 encoding. Once more, we’ll first share with you the three steps that can perform the Base64 decoding course of in PowerShell, after which we’ll describe all these steps one after the other. The next picture exhibits the entire Base64 decoding course of in PowerShell in Home windows 10:
In step one of the Base64 decoding course of in PowerShell, now we have outlined a variable “$ENCODED” that holds an encoded string. By the way in which, now we have used the identical string over right here that now we have encoded above. Then within the second step, now we have created one other variable, “$DECODED,” for holding the decoded string. We’ve got assigned the outcomes of the assertion “[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($ENCODED))” to the “$DECODED” variable.
This assertion will merely convert the encoded Unicode bytes to a traditional decoded string. Then within the third step, for printing the decoded string on the PowerShell window, now we have used the “Write-Output $DECODED” assertion that will likely be liable for printing the contents of the “$DECODED” variable on the PowerShell window.
As quickly as you hit the Enter key after typing within the third assertion, the decoded string will seem on the PowerShell window, as proven within the picture under. You may evaluate this decoded string along with your unique string, and it is possible for you to to confirm that the Base64 encoding and decoding processes have been appropriately carried out utilizing the PowerShell software in Home windows 10.
This information was designed to share with you the method of doing the Base64 encoding and decoding in PowerShell in Home windows 10. On this regard, we shared with you the PowerShell instructions that assist in performing the Base64 encoding and decoding of the specified knowledge. By making use of those instructions, you possibly can simply encode and decode any given strings with the Base64 coding in PowerShell in Home windows 10.
Did you want this text?
Share it on any of the next social media channels under to offer us your vote. Your suggestions helps us enhance.