Giving a Windows directory a drive letter

Sometimes you need to test a program/script on your local machine that is expecting a certain drive, let's say X: drive. Your local machine may only have a C: drive, so what do you do?

You could reconfigure the script to use your C: drive but this is an unnecessary extra step. Instead you can create drive letters that map to Windows directories (folders) using the SUBST command.

It's easy, at your command line, type:

subst DRIVE_LETTER: PATH

For example:

subst X: C:\temp\testdata

You must not add a trailing slash to the directory or it will not work.

Once you're done, just add /D to the command plus drive letter, e.g.

subst X: /D
Hope this makes your life easier!

[Via Lifehacker -> via Codejacked]

No comments:

Post a Comment