Repository: pyenv-win/pyenv-win (language: python)

Issue:
PATH is updated after pyenv batch
**To Reproduce**
![image](https://user-images.githubusercontent.com/626824/117346947-b804e780-aea8-11eb-848d-2f30b9847153.png)

**Expected behavior**
PATH should be reverted back to its original value.



Discussion / hints:

Fix patch:
diff --git a/.version b/.version
index 7015fe1e..766639f6 100644
--- a/.version
+++ b/.version
@@ -1,1 +1,1 @@
-2.64.7.1
\ No newline at end of file
+2.64.7.2
\ No newline at end of file
diff --git a/README.md b/README.md
index d8e8c5e2..9b67ec22 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ For existing python users, we support [installation via pip](#installation).
 
 Contributors and Interested people can join us on @[Slack](https://join.slack.com/t/pyenv/shared_invite/zt-f9ydwgyt-Fp8tehxqeCQi5mi77RxpGw). Your help keeps us motivated!
 
-   
+![Build Status](https://travis-ci.org/pyenv-win/pyenv-win.svg?branch=master)
 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
 [![GitHub issues open](https://img.shields.io/github/issues/pyenv-win/pyenv-win.svg?)](https://github.com/pyenv-win/pyenv-win/issues)
 [![Downloads](https://pepy.tech/badge/pyenv-win)](https://pepy.tech/project/pyenv-win)
@@ -222,7 +222,32 @@ Now follow the steps to "[finish the installation](#finish-the-installation)".
 
 ## Change Log
 
+### New in 2.64.7.2
+- Fix [#250](https://github.com/pyenv-win/pyenv-win/issues/250): PATH is not impacted after a `pyenv exec`.
+
 ### New in 2.64.7.1
+- Fix [#246](https://github.com/pyenv-win/pyenv-win/issues/246): `pyenv which` and `pyenv whence` show help if no argument specified.
+- Fix exec problems after merge of [#140](https://github.com/pyenv-win/pyenv-win/pull/140).
+- Fix [#247](https://github.com/pyenv-win/pyenv-win/pull/247): no more incorrect file name in bash script if username contains a space.
+- Fix [#243](https://github.com/pyenv-win/pyenv-win/issues/243): hot fix for `pyenv exec`.
+
+### New in 2.64.6.1
+- Use GitHub Actions to publish to PyPi.
+
+### New in 2.64.5
+- Fix [#239](https://github.com/pyenv-win/pyenv-win/issues/239): Improve `rehash` error when no version installed.
+- Add pypy support.
+- Fix [#140](https://github.com/pyenv-win/pyenv-win/pull/140): Get rid of temp `exec.bat` to support multiple exec in parallel.
+
+### New in 2.64.4
+- More python versions supported.
+- Fix [#217](https://github.com/pyenv-win/pyenv-win/pull/217): Add missing call to `exec.bat`.
+- Enhancement [#225](https://github.com/pyenv-win/pyenv-win/pull/217): Add tox support.
+- Fix [#204](https://github.com/pyenv-win/pyenv-win/issues/239): Support many local versions.
+- Enhancement [#220](https://github.com/pyenv-win/pyenv-win/issues/220): Rehash all installed versions with more shims.
+- Enhancement [#221](https://github.com/pyenv-win/pyenv-win/pull/221): Add `pyenv global --unset`.
+
+### New in 2.64.3
 - Version naming conventions have now changed from using 64-bit suffixes when specifying a version to (un)install. Now all you need to use is the version number to install your platform's specific bit version.
    - **\*WARNING\*: This change is backwards incompatible with v1.2.5 or less; if upgrading from that version, install [32bit-train](#32bit-train-support) which is backward compatible, or uninstall all versions of python prior to upgrading pyenv.**
    - Ex. `pyenv install 2.7.17` will install as 64-bit on x64 and 32-bit on x86. (64-bit can still use `2.7.17-win32` to install the 32-bit version)
diff --git a/pyenv-win/bin/pyenv.bat b/pyenv-win/bin/pyenv.bat
index 1b84bd4c..3974dca1 100644
--- a/pyenv-win/bin/pyenv.bat
+++ b/pyenv-win/bin/pyenv.bat
@@ -49,8 +49,6 @@ if not exist "%bindir%" (
   exit /b
 )
 
-rem TODO test unicode
-
 set cmdline=%*
 set cmdline=%cmdline:~5%
 :: update PATH to active version and run command
@@ -58,7 +56,9 @@ set cmdline=%cmdline:~5%
 set cmddir=
 if exist %bindir%\%2 set cmddir=%bindir%\
 if exist %bindir%\%2.exe set cmddir=%bindir%\
-endlocal && set "path=%bindir%;%bindir%\Scripts;%path%" && %cmddir%%cmdline%
+set "path=%bindir%;%bindir%\Scripts;%path%"
+%cmddir%%cmdline%
+endlocal
 exit /b
 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 :plugin
diff --git a/pyenv-win/libexec/pyenv---version.bat b/pyenv-win/libexec/pyenv---version.bat
index f20757f7..750d4f47 100644
--- a/pyenv-win/libexec/pyenv---version.bat
+++ b/pyenv-win/libexec/pyenv---version.bat
@@ -1,6 +1,6 @@
 @echo off
 setlocal
-set KNOWN_VER=2.64.7.1
+set KNOWN_VER=2.64.7.2
 
 if "%1" == "--help" (
 echo Usage: pyenv --version


Test patch:
diff --git a/tests/test_pyenv_feature_exec.py b/tests/test_pyenv_feature_exec.py
index c9a69156..763fc5fc 100644
--- a/tests/test_pyenv_feature_exec.py
+++ b/tests/test_pyenv_feature_exec.py
@@ -90,15 +90,6 @@ def test_exec_arg(self, setup, command, arg):
                 print(f'stderr: {stderr}')
             assert stdout == arg.replace('%World%', 'Earth')
 
-    def test_exec_set_var(self, setup):
-        with TemporaryEnvironment({'VARIABLE': 'OLD'}):
-            pyenv = str(self.__class__.ctx.pyenv_path / "bin" / "pyenv.bat")
-            args = [pyenv, "exec", "SET", "VARIABLE=NEW", "&&", "SET", "VARIABLE"]
-            result = subprocess.run(args, capture_output=True, encoding="utf8")
-            # \x0c: generated by cls in cmd AutoRun
-            stdout = result.stdout.strip("\r\n\x0c")
-            assert stdout == "VARIABLE=NEW"
-
     @pytest.mark.parametrize(
         "args",
         [
@@ -119,6 +110,20 @@ def test_exec_help(self, setup, args):
         stdout = result.stdout.strip("\r\n\x0c")
         assert "\r\n".join(stdout.splitlines()[:1]) == pyenv_exec_help()
 
+    def test_path_not_updated(self, setup):
+        python = str(self.__class__.ctx.pyenv_path / "shims" / "python.bat")
+        tmp_bat = str(Path(self.__class__.ctx.local_path, "tmp.bat"))
+        with open(tmp_bat, "w") as f:
+            # must chain commands because env var is lost when cmd ends
+            print(f'@echo %PATH%', file=f)
+            print(f'@call {python} -V>nul', file=f)
+            print(f'@echo %PATH%', file=f)
+        args = ["call", tmp_bat]
+        result = subprocess.run(args, shell=True, capture_output=True, encoding="utf8")
+        # \x0c: generated by cls in cmd AutoRun
+        stdout = result.stdout.strip("\r\n\x0c").splitlines()
+        assert stdout[0] == stdout[1]
+
 
 def pyenv_exec_help():
     return "Usage: pyenv exec <command> [arg1 arg2...]"