Created
June 7, 2013 11:30
-
-
Save preavy/5728656 to your computer and use it in GitHub Desktop.
Evaluate PowerShell code from inside Emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| How to use: | |
| Write some PowerShell code in any Emacs buffer. | |
| Select the region to evaluate, then M-x eval-region-powershell to evaluate it as a PowerShell script block. | |
| The output goes into *Shell Command Output*. | |
| (defun eval-region-powershell () | |
| (interactive) | |
| (shell-command | |
| (concat "powershell -noprofile -encodedcommand " | |
| (base64-encode-string | |
| (encode-coding-string (buffer-substring (mark) (point)) 'utf-16le))))) | |
| A great alternative to REPL-based development or the PowerShell ISE. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment