Skip to content

rkiggen/ob-powershell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

ob-powershell

Execute powershell commands from org mode source blocks.

Setup

Install from melpa

With use-package just add the declaration

(use-package ob-powershell)

Install with straight.el

(use-package ob-powershell
  :straight t
  :commands
  (org-babel-execute:powershell
   org-babel-expand-body:powershell))

Install from source

  • clone from github
  • add to load path
(add-to-list 'load-path "~/.emacs.d/lisp/ob-powershell")
  • add to your .emacs:
(require 'ob-powershell)

Add powershell to babel languages

(org-babel-do-load-languages
 'org-babel-load-languages
 (quote (
         ;; ...
         (powershell . t))))

Configure OS command

On different OSs the command for Powershell differs. Configure the shell command according to the installation on you OS.

(customize-set-variable 'org-babel-powershell-os-command "pwsh")

Usage

Add a source block with powershell language:

#+name: get-env-path
#+begin_src powershell
echo $env:path
#+end_src

And execute it using org-babel-execute-src-block.

Another example with a variable:

#+begin_src powershell :var tmp="Hello World!"

:

Write-Host $tmp

:

#+end_src

:

#+RESULTS:
: Hello World!

About

Emacs Babel Powershell implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published