i have this hybris batch/powershell base64 decoder and i want to decode the string in powershell and set the decoded variable to a variable in batch, this is my code
@echo off
set syscall=dGVzdGluZ3hk
powershell.exe $decoded=[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:syscall));
Use a for /f
statement to capture the output from a command (run for /?
in a cmd.exe
session for more information):
@echo off
set "syscall=dGVzdGluZ3hk"
for /f "usebackq delims=" %%i in (`powershell.exe -noprofile -c "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:syscall))"`) do set "decoded=%%i"
After executing the above, %decoded%
contains testingxd
.