1

I'm trying to query a user for the path to an installed program (for some reason the PATH env variable was not correctly updated during the installation).

I do the following:

@ echo off
echo using %ppath%
where /q python2
if errorlevel 1 (
    set /p ppath= "Please enter the path to your python installation: "
    echo using %ppath%
)

For testing purpose I explicitly look for python2 which is not in the PATH of my machine My issue is that echo using %ppath% never prints what I just entered but the content of %ppath% from the previous execution of the batch file. Here is a sample interactive usage:

C:\MyData\SoftDev\git\PDC_Python>fix_python_installation.bat
using install1
Please enter the path to your python installation: install2
using install1
C:\MyData\SoftDev\git\PDC_Python>fix_python_installation.bat
using install2
Please enter the path to your python installation:

Any help would be greatly appreciated. I need unfortunately to stick to windows batch command for this task.

Jean-Marc Volle
  • 3,113
  • 1
  • 16
  • 20

0 Answers0