Today I learned about a very useful command in Windows Vista:
mklink. We create hard and soft links with
mklink just like with Unix like operating system's
ln command. Especially the soft links are useful, because we can create a link which points to another file or directory. The link can be accessed as if we access the original file or directory.
Personally I like to create a
bin directory at the root of my drive and put it in the
PATH variable. In this
bin I create soft links to the executables I want accessible from the
PATH variable. This way I don't have to add a lot of directories to the
PATH environment variable.
mkdir \bin cd bin mklink java.exe %JAVA_HOME%\bin\java.exe
If we run the
dir command we can see which files are links, because they are denoted by
We can also use the
mklink command to shorten deep directory names. For example if I work on a project in the directory
C:\Users\hkleinikkink\data\work\projects\client\applications\dev I want to use the short name currentproject:
mklink /D C:\currentproject C:\Users\hkleinikkink\data\work\projects\client\applications\dev cd \currentproject
To remove a directory link we must use the
rmdir and not the
del will delete all files in the directory.