Use subst to Deal with Long Path Names

The Problem

I want to shorten the paths to a directory that is buried deep in the file system. In my daily work, I often need to cd into such directory as long as:


Although Windows command line has file name completion, it is still a long and tedious process to change into and out of these directories.

The Solution

There are several solutions, such as using environment variable to point to the destination directory, or to create alias to cd there (via doskey). My favorite solution uses subst to substitute the long path with a drive letter:

subst F: C:\projects\tests\utilities\fileutil

From this point on, I can switch to this long directory using the shorter drive alias. Instead of

cd C:\projects\tests\utilities\fileutil

I can get to it by changing the drive:


By using a drive to access a deeply buried directory, I also get around the problem of 260-character path name limit in Windows.


3 thoughts on “Use subst to Deal with Long Path Names

  1. Corey Lean

    Yes you can change the directory or you can also change the file name but what if there are too many files to copy and many of them have long path name error. You can’t change every files directory neither you can rename each one. I would suggest you to try GS Richcopy 360. It worked very well for me, still using it, almost an year has passed. Still no complains!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s