rkiggen / ob-powershell

Emacs Babel Powershell implementation
MIT License
13 stars 6 forks source link

How to keep a global variable in the powershell buffer of emacs ? #3

Open Frabice opened 2 years ago

Frabice commented 2 years ago

Hi, I'm try to use ob-powershell in emacs and want to keep some assigned variables between my multiple #+begin_src powershell ... #+end_src sections. I tried this with no success:

#+name: Test de passage de variable entre bloc sur la même session 1/2
#+begin_src powershell :session *powershell_session* :results output :exports both
      $PASS="MyP@ssw0rd"
      Write-Host "Le password est '$($PASS)'"
#+end_src
#+RESULTS: Test de passage de variable entre bloc sur la même session 1/2
      : Le password est 'MyP@ssw0rd'

#+name:  Test de passage de variable entre bloc sur la même session 2/2
#+begin_src powershell :session *powershell_session* :results output :exports both
      Write-Host "Le password est '$($PASS)'"
#+end_src
#+RESULTS: Test de passage de variable entre bloc sur la même session 2/2
      : Le password est ''

Anyone have an idea how can I do?

Thank's for your interest...