Virtual Drive Paths On Windows
Here's a trick that I learned recently, using the Command Prompt on Windows.
It's the subst command. Use the "/?" flag to read the help, like so:
subst /?
subst command help description.
It will tell you how it can be used to map a path on disk on your computer to a virtual path.
How is this useful? Well, at least on Windows, you can have a fixed drive path for specific things. If you map a library of assets to a virtual drive "L:", regardless of where that path is in your actual disk, your programs and scripts can find the files it needs.
Maybe you want to have a virtual drive to store your working projects in "W:". Even you if you plug drives to different a computer in the future and the real letters change(which can happen), by updating the virtual path, everything will work again.
The term "Environment Variable" might have cropped up in your head reading those last paragraphs. Yes, the functionality is very similar to a environment variable, at least from a philosophical standpoint. But as far as Windows goes, I believe the subst command is superior.
After setting your virtual path, Windows treats that drive as real as it gets: It's visible on your file explorer for quick access, and inside file pickers in all your programs, like Blender and Photoshop. And that's where its advantage really shines: Very few programs(Houdini being a notable exception) allows you to insert and expand environment variables on paths when loading a texture file, for example. But with a virtual path, you type the target file path and it works like a real location on disk.
A virtual path "W:" mapped from somewhere on drive "F", visible in Blender's file picker.
Let's do an example. I want to have all my projects stored at root of a virtual "W:" drive, and all my projects are currently stored in the real path E:\Works\Projects. You would run:
subst w: E:\Work\Projects
You will see the "W:" pop up in your Windows File Explorer, and although it is mapped to a real location on the drive "E:", the address bar still displays the path as "W:".
If you want that path to persist when you boot your machine, you need to convert it to a ".bat" file place it on your Windows startup folder. The startup folder is likely located at
C:\Users\<YourUser>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.
Just go to that folder, create a new file with the ".bat" extension and paste the desired contents, which in our example, was:
@echo off subst w: E:\Work\Projects
Done. Now your virtual drive will always be available to you. I know for sure this trick works as far back as Window 7, but considering old _Amiga_ warriors used something similar in their days, it likely works on even older versions of Windows. Something to try someday on a Windows XP virtual machine when feeling nostalgic.
See you next mission.