Why does a batch file switching current directory for command prompt not work on using SETLOCAL command?
问题 I am running the following batch script from within a command prompt window to go to a specific folder. @echo off SETLOCAL set ispyfolder=true if not "%~1"=="py" if not "%~1"=="pyfolder" set ispyfolder=false if "%ispyfolder%"=="true" ( C: cd C:\Users\ankagraw\AppData\Local\Continuum ) This code doesn't work when SETLOCAL is there (2nd line). The current directory is the same as before running the batch file from within a command prompt window. If I remove this line, then the script works fine