954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

set bat script path variable

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

k2k
Posting Whiz
352 posts since Nov 2007
Reputation Points: 15
Solved Threads: 1
 

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!

VulcanDesign
Light Poster
46 posts since Jan 2010
Reputation Points: 10
Solved Threads: 5
 

very helpful thanks so much

k2k
Posting Whiz
352 posts since Nov 2007
Reputation Points: 15
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You