Evaluate The Active Region In Emacs Using Powershell
Write some PowerShell code in any Emacs buffer.
Select it, then M-x eval-region-powershell
to evaluate as a PowerShell script block. The output goes into *Shell Command Output*
.
Update: Much improved thanks to a comment by TarMil
(defun eval-region-powershell ()
(interactive)
(shell-command
(concat "powershell -noprofile -encodedcommand "
(base64-encode-string
(encode-coding-string (buffer-substring (mark) (point)) 'utf-16le)))))