title: why is my cd %myVar% being ignored?
body: <p>I save my original path in <code>originalPath</code> and then move to another folder. At the end when I do <code>cd %originalPath%</code>, it doesn't work. It stays in the new path.</p>
  
  <p>I have tried using <code>pushd %myPath%</code> and <code>popd</code>, but it doesn't work either.</p>
  
  <p><code>C:\BatchTests\</code> has my script and the folder <code>Subfolder1</code>.</p>
  
  <p>My script:</p>
  
  <pre><code>@echo off
  set myPath=Subfolder1
  set folderList=input.txt
  REM set originalPath=%CD%
  set originalPath=%~dp0  
  
  REM pushd %myPath%
  cd %myPath%
  setlocal EnableDelayedExpansion
  
  :process
  
  REM The rest of my script
  
  echo %originalPath%
  REM echo %originalPath% prints: C:\BatchTests\
  cd %originalPath%
  REM popd
  pause
  </code></pre>
  
  <p>Why is this happening?</p>