assuming you remain on the same drive, i.e. no D:
then cd D:\somedir\
needed.
In my case, C: holds system files, but all work is on D:
2 parts. first set some working directories, using a batch file.
let's say localprofile.cmd. You can have multiple ones of these, just run them as needed.
set wd1=D:\home\work\fb440.dumper
set wd2=D:\home\work\py\tests
now use another command file to move around, based on those environment variables you just set.
wd.cmd
echo off
d:
if %1.==. set | findstr wd
if %1==1 cd %wd1%
if %1==2 cd %wd2%
if %1==3 cd %wd3%
if %1==4 cd %wd4%
if %1==5 cd %wd5%
if %1==6 cd %wd6%
And a bit of a sample use:
D:\home\bin>wd 2
D:\home\bin>echo off
D:\home\work\py\tests>wd 1
D:\home\work\py\tests>echo off
wd by itself is supposed to show me the list of bookmarked directories. It works, but not sure why I am getting this "unexpected cd" message.
D:\home\work\fb440.dumper>wd
D:\home\work\fb440.dumper>echo off
wd1=D:\home\work\fb440.dumper
wd2=D:\home\work\py\tests
cd was unexpected at this time.
D:\home\work\fb440.dumper>
Regular .cmd batches
Aside from directory navigation, you can create a foo.cmd somewhere on your PATH and it can act much as an alias. Remember, unlike Linux/OSX shells, cmd files can affect environment variables and the session, without needing to source them.
I have a cdbin.cmd to navigate me, for example:
d:
cd \home\bin
And this is a pseudo-grep grep.cmd
findstr -n %1 %2
in action (whatever sort /+2 /+10 means)
D:\home\work\fb440.dumper>grep class *.py | sort /+2 /+10
dumper2.py:18:class PrettySafeLoader(yaml.SafeLoader):
dumper2.py:27:class Comparator(object):
dumper2.py:3:class module_settings:
linker2.py:5:class module_settings:
dumper2.py:65:class DataCompProcessor(object):
dumper2.py:69:class DataCompTextRenderer(DataCompProcessor):
dumper2.py:76:class DataComparator(object):
doskey
(don't be fooled by the name it is not the old MS DOS doskey). Usedoskey /?
for more information. Other than that, I'm afraid, this question is off topic here.