     (run-specware4 root-dir)
     (sleep-for 2)
     (sw:eval-in-lisp (format "(top-level::do-command :cd %S)" root-dir))
-    (sw:eval-in-lisp (format "(setf (sys:getenv \"SWPATH:/\") %S)" root-dir))
+    (sw:eval-in-lisp (format "(setf (sys:getenv \"SWPATH:/\") %S)" (replace-backslash-by-slash root-dir)))
     (sw:eval-in-lisp (format "(setf (sys:getenv \"SPECWARE4\") %S)" root-dir))
     (sw:eval-in-lisp "(time (user::boot))")
     (build-specware4 root-dir)))

    (if (eq (elt str last) ?/)
	(substring str 0 last)
      str)))

;; The following is almost the same as the above. The difference is that
;; in the following we execute a Specware application (rather than run Lisp

    (unless (inferior-lisp-running-p)
      (sleep-for 1))
    (sw:eval-in-lisp (format "(setf (sys:getenv \"SWPATH\") %S)"
			     (concat (replace-backslash-by-slash root-dir) ":/")))
    (sw:eval-in-lisp (format "(setf (sys:getenv \"SPECWARE4\") %S)" root-dir))
    (sw:eval-in-lisp (format "(top-level::do-command :cd %S)" dir))
    (sw:eval-in-lisp "(load \"Specware4.lisp\")")
