Wednesday, April 7, 2010

one-liner: mount the current directory to a temporary top-level drive letter

Suppose you're doing command line stuff in some ridiculously deep folder, e.g. C:\some path\to some\ridiculously deep\folder\way down\below a reasonable\level>, so the default command prompt pushes way over to the right edge of the screen, and any output containing the wraps 3 times in the window, and it's just really hard to read:



The following one-liner will "substitute" a temporary drive x: for the current path, effectively mounting C:\some path\to some\ridiculously deep\folder\way down\below a reasonable\level> as x:\

for /f "tokens=*" %i in ('cd') do @subst x: "%i"

Delete the temporary drive with the command subst /d x:

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.