diff --git a/module2/ressources/rr_org/init.el b/module2/ressources/rr_org/init.el
index 12a552d0ed95036a0fc9ae9877a0307a1e0696ec..01b758661248c977b146cac2190c03ccfd7c13d4 100644
--- a/module2/ressources/rr_org/init.el
+++ b/module2/ressources/rr_org/init.el
@@ -232,8 +232,13 @@ Entered on %U
(add-to-list 'org-structure-template-alist
'("PP" "#+begin_src python :results file :session :var matplot_lib_filename=(org-babel-temp-file \"figure\" \".png\") :exports both\nimport matplotlib.pyplot as plt\n\nimport numpy\nx=numpy.linspace(-15,15)\nplt.figure(figsize=(10,5))\nplt.plot(x,numpy.cos(x)/x)\nplt.tight_layout()\n\nplt.savefig(matplot_lib_filename)\nmatplot_lib_filename\n#+end_src" "\n\n"))
-(add-to-list 'org-structure-template-alist
- '("b" "#+begin_src shell :results output :exports both\n\n#+end_src" "\n\n"))
+(if (memq system-type '(windows-nt ms-dos))
+ ;; Non-session shell execution does not seem to work under Windows, so we use
+ ;; a named session just like for B.
+ (add-to-list 'org-structure-template-alist
+ '("b" "#+begin_src shell :session session :results output :exports both\n\n#+end_src" "\n\n"))
+ (add-to-list 'org-structure-template-alist
+ '("b" "#+begin_src shell :results output :exports both\n\n#+end_src" "\n\n")))
(add-to-list 'org-structure-template-alist
'("B" "#+begin_src shell :session *shell* :results output :exports both \n\n#+end_src" "\n\n"))
diff --git a/module2/ressources/rr_org/init.org b/module2/ressources/rr_org/init.org
index 3e94a68c5ecad65988bdac90eb7970d22d908196..60c3c6dd6ca3eba5c4c122419aa937459487bd53 100644
--- a/module2/ressources/rr_org/init.org
+++ b/module2/ressources/rr_org/init.org
@@ -395,8 +395,13 @@ To use this type
\n\n"))
+(if (memq system-type '(windows-nt ms-dos))
+ ;; Non-session shell execution does not seem to work under Windows, so we use
+ ;; a named session just like for B.
+ (add-to-list 'org-structure-template-alist
+ '("b" "#+begin_src shell :session session :results output :exports both\n\n#+end_src" "\n\n"))
+ (add-to-list 'org-structure-template-alist
+ '("b" "#+begin_src shell :results output :exports both\n\n#+end_src" "\n\n")))
#+end_src
To use this type