Using variables in a file path directory in a batch file
batch-file, cmd, directory, path, variables
Solution
You need to `SET` your variable.
For example:
SET a=Jan2000
CD P:\Reference\Data\2000\%a%
Problem
I have a reasonably simple question, however i cannot seem to find a solution anywhere. I'm working with some variables in a batch file, and i would like to change the directory according to the variable. eg, ``` variable SET /Jan2000 = a cd P:\Reference\Data\2000\%a% ``` When i run the batch file, it just stays in the "2000" folder, it does not go the folder below like i ask. Is there any way to get this to work? Edit: by request, here is the exact code as it is writtenin the batch file. Thanks for the help. ``` chdir /D P:\Reference\Data\2000 SET Jan2000 = a chdir P:\Reference\2000\%a% dir pause ```