Photo by Qfamily
Today’s command line adventure is an oldie but a goodie. Many years ago I was helping my father set up an accounting software package. This program had a server and workstation component. My dad had only two computers and so he wanted to use one of the workstations as the server. But there was a catch.
The workstation component would only access the server on a mapped drive letter, the drive letter couldn’t be local. No problem, I thought, I’ll just map to the server share locally, as though I’m running off a normal workstation. No go, the workstation actually had the temerity to check if the map was to a shared volume on the local computer.
I wasn’t sure what to do, my dad didn’t want to buy another computer just for this one program. After some Googling (it may have actually been AltaVista-ing back then) I found the subst command. Subst is short for substitute (I guess, the documentation doesn’t say.) It lets you create a drive drive letter that points to a local directory, it’s like mapping to a local share but without having to share. That did the trick, it was enough to fool the workstation software into thinking it was talking to a remote server.
I’ve found this command useful over the years when I need to access a directory in a deep hierarchy multiple times, and it saves me from having to constantly navigate down into it. It was particularly useful back in the day when I spent most of my time on the command line and having to cd back and forth between 10 directory deep paths got really tedious.