I am creating a batch file i am on a path
C:\Validation\docs\chm
I want to move back to the
C:\Validation part
which is in %DialogPath% This was entered by the user but when i write
CD /D %DialogPath%
An error occurs that tells this path does not exists
Until you give more details as to the script in question, we can only guess to what the problem may be.
However, since you are changing the current directory only for a limited time you should be using the
pushd
andpopd
commands.Example: (Run this .bat script to see how
pushd
andpopd
work!)For help type
pushd /?
orpopd /?
into the command prompt.The direct answer to your question would be
But
cd /D C:\Validation
also works.The problem is more likely with the variable than then command.
You can move up one path with
cd ..
. If you do that twice, you will land in theC:\Validation
directory.In your example it would look like this: