Maybe the following could work, it seems to do what you want when I try
it here.
(progn
(let ((default-directory "path1"))
(eshell t)
(rename-buffer "b1"))
(let ((default-directory "path2"))
(eshell t)
(rename-buffer "b2")))
This is a working solution for me.
(progn
(eshell t)
(eshell/cd "path1")
(eshell-send-input)
(eshell t)
(eshell/cd "path2")
(eshell-send-input))
The above snippet does not seem to work for me. Could you please explain the below lines ?
(eshell t) -> This opens up a new eshell
(eshell/cd "path1") - ?????
(eshell-send-input) - I am guessing the command in the previous step gets passed on using this command.
Hope it helps in some small way.