I am new to batch script. I am having bat file located in path and I need to move to one folder above, but i tried multiple ways to move folder up but is still being in the same folder.
I have added output for each try. Not sure whats wrong with each command I am not able to move one folder up.
Please let me know the command to move one folder up like c:workspaceLocalTestA
and navigate to c:workspaceLocalTestAFolder2
current bat Directory : c:workspaceLocalTestAFolder1test.bat
Expected directory to be moved c:workspaceLocalTestA
Directory structure: c:workspaceLocalTestAFolder1
c:workspaceLocalTestAFolder2
@echo ON
setlocal
:: First Try
set SRC_DIR=%~dp0
@echo %SRC_DIR%
:: Output c:workspaceLocalTestAFolder1
:: Second Try
@echo %SRC_DIR%..
:: Output c:workspaceLocalTestAFolder1..
:: Third Try
set SRC_DIR = %CD%..
@echo %SRC_DIR%
:: Output c:workspaceLocalTestAFolder1..
::Fourth Try
set SRC_DIR_1=%~dp0..
@echo %SRC_DIR_1%
:: Output c:workspaceLocalTestAFolder1..
::Fifth Try
set FOLDER2_DIR_1 = %SRC_DIR%Folder2
@echo %FOLDER2_DIR_1%
:: Output c:workspaceLocalTestAFolder1Folder2
::Sixth
@echo Current Directory = %CD%
:: Output c:workspaceLocalTestAFolder1
:: Revert back to the previous Working Directory
popd
set FOLDER2_DIR_2= %SRC_DIR%Folder2
@echo %FOLDER2_DIR_2%
:: Output c:workspaceLocalTestAFolder1Folder2
:: Changing the path
%cd% %FOLDER2_DIR_1%
@echo Current Folder2 Directory = %CD%
:: Output c:workspaceLocalTestAFolder1Folder2
pushd "%FOLDER2_DIR_1%"
@echo Current Directory with pushd command = %CD%
:: Output c:workspaceLocalTestAFolder1Folder2