set v1=%e:\file1\file0%
set v2=%c:\file1\file0%
set v3=%d:\file3\file4%

cd %v1% and do something
cd %v2% and do something
cd %v3% and do something

I just want to set a variable = path and cd to it later, since I have multiple pathes, i would like to cd to diff variables instead of typing over and over the same pathes.

does anyone know the syntax doing stuffs like this?

thanks

Recommended Answers

All 2 Replies

That wasn't stated very clearly, but I think you were asking how to assign some paths to variables for later use? Try the below example.

set /p path1= "C:\Program Files\Installation\Help-Files"
set /p path2= "C:\Users\Bob-Smith\Documents\My Folder"

cd %path1%
:: Do something

cd %path2%
:: Do something

Cheers!

very helpful thanks so much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.