How's it going guys.
So I got another feature for you in Windows that you probably didn't know
about, but definitely could come in handy.
And it's the ability to take any folder on your computer and
mount it as a virtual drive.
So if you had some folder on your desktop somewhere or wherever, you could
take it and actually make a virtual drive, such as say the X drive, and
when you click into the X, it would actually go straight into that folder
and look like you're in that folder.
It's very similar to symbolic links that I talked about, but those are
for mapping one folder and directory to another one file to another.
Whereas this is for creating a virtual entire drive basically.
This could come in handy for a number of reasons.
Maybe you have a folder that you access so frequently that it makes sense to
just mount it as its own drive virtually.
It still exists in its regular path, but you can now access it
just by going to a top level drive.
It's really easy to access, remember where it is.
Or maybe you have a folder with lots of references from other programs,
but you know, that folder is going to be moved around a lot to different
parts of the drive, maybe even an external drive at some point.
So this way you can actually create a virtual drive that all the programs know
that location as, but then if you move that folder around, you can simply change
where that virtual drive points to.
And these programs won't know the difference.
Specifically doing this can be accomplished in a couple different ways.
There's two commands that I'm mostly going to explain and show, one is
"subst," which is short for substitute, and the other one is "net use".
So I'm gonna actually go over to the computer and show you
how to use these two commands.
They're a little bit different, have a little bit slight advantages
over each other, so you can decide how you want to do it.
Let's go over to the computer.
All right.
So we're going to start off at the command prompt.
And the first one we're going to do is the subs to command.
So you can see a little bit more information about this one.
If you type in the slash question mark, and you can see how this command works.
So basically you type in subst so we can do.
And then the drive letter that we're going to be mapping.
So let's say X: and then you need to put the drive letter and
path that you want to map to.
So I'm going to do B:\ and if you just want the map directly to a
root letter, you just type like this B:\ and end it with a backslash.
But if you want to go further in, you type the full path and then leave the
backslash off the end of the full path.
So that's just a little bit of a quirk.
Also, you need to not be running this as administrator.
For some reason, it won't work if you run as an administrator.
So then I'll wait to do is do that.
Now, when we open this up, you can see it wasn't here before.
But if I refresh, I actually had to refresh a second time, but
eventually it did show up here as X.
And if we click into it, it now goes into, well, I didn't even show you
the folder I was creating before.
This is the one we're going into B:\Test.
And as you can see, if we go into X and now goes in here now.
Before you go and do this, there are two issues that you're definitely
going to want to know about.
First of all, this is not going to persist through a reboot.
So this will disappear after a reboot.
There are two ways to fix it.
I'm going to go over.
And the other thing is you can not actually rename this.
So you'll notice how this took the name.
Of the root letter drive of what we went into, even though this
goes into the "test" folder, it didn't get named as "test".
So that's one thing that you might not like.
The other command I'll talk about will allow you to rename it, but
we'll get to that in a second.
So let's go over two ways to actually make this persistent through a reboot.
The first way is to use the start-up folder in Windows.
So you might not have known about this.
If you go and type in, "run" into the start menu to bring
up the run box and type in shell:startup, it will open a folder.
And this is a special folder because everything in this folder
will start up with Windows.
It's kind of like an automatic run.
So what we can do is create a new file.
So I'll call this...
you can either call it .bat or .cmd, but we'll call it subst.cmd.
Actually, we'll just call it drives.
So it doesn't confuse anyone.
So we'll call it this, and then edit with notepad.
And then we could basically just have it run the commands
we just ran on start-up.
So we can do "@echo off" that's just for the batch thing.
And then we can do what we typed in before we can literally just copy and paste it.
And then this should now run at startup and do the same thing
we did every time Windows boots.
The trouble with this method is if you need the drive to be accessible
from early stages of the boot, like if services are going to use it or
something, it might not work because the
startup programs are kind of launched later in the log-in
process, if that makes sense.
But there is another thing you can do, which is to add
the program in the registry.
Before you do anything though, always make sure you back up the registry
before messing with it, because there is no undo in the registry editor.
So if you accidentally delete something you weren't supposed to, there's no coming
back from it unless you backed it up.
So always go to File > Export > Export Range "all", and then just
call it backup whatever, and put it on the desktop or something.
Anyway, so what we need to do is go to this path.
So eventually you go down to HKEY_Local_Machine\System\CurrentControlSet\
Control\Session Manager\DOS Devices, and then you click into here.
And what you need to do is create a new string value.
And we're going to call it that drive letter that you want to mount.
So let's just call it V: I don't think I'm using that for anything.
And then we're going to right click and hit modify.
And this is where you will type in the data to basically mount the drive.
And this is different from the subst command.
It'll do the same thing, but it'll start earlier in the boot
process and the login process.
So what you have to do is type it in this way.
So you do \??\. And this is the UNC path format, if you're not familiar with it.
So slash (backslash by the way), and then another slash after the
question marks and then the drive letter that we're going to go into.
So B:\Test.
So it'll just look like this.
We hit okay.
And then after the reboot, it will show up.
Unfortunately, I would have to restart the computer.
Just restarting Windows Explorer, or even refreshing is not
going to make this show up.
It actually happens at the login or the boot up.
So I'm not going to go through all that, but trust me, it will show up and actually
this S: one is one that I had in here and deleted it before the demo,
but that's where that one came from.
But again, this will have the same issue where you can't rename the drive.
Though, it will look like just a virtual drive.
All right.
Now the next method, which also will persist through the reboot and we'll
actually let you renamethe drive,
is to use the "net use" command.
So it'll be "net use" and I'll put it on the screen for now because
there are some things we're going to change, but first you're going to
need to get the name of the computer.
If you don't know what it is, you can simply type in "hostname".
And that will show you.
I already know mine is Joe-PC.
So anyway, the full command, how you use it is you type in "net use" and
then we need to type in the drive letter that we're going to be mounting.
Let's call it R: (I think I was using Q for something) and then a
space and then we type two slashes, then the name of the PC, another
backslash, and then the drive letter,
B, and then a dollar sign.
So not a colon, a dollar sign.
Again, this is like the UNC path.
That's just how it is.
And then you type slash and then whatever path you want to go into.
So test, if you wanted to go to test whatever, blah, blah, blah,
you could do that, but just leave it at that with no slash on the end.
And I believe if you had a folder with a space in it, you would have to add quotes
around it possibly, but mine doesn't.
But also you can't forget to add, this which is /persistent:yes
and that will make sure that it is persistent through reboots.
So then all we have to do is hit Enter.
It says completed successfully, and now immediately it showed up.
So this is the Test folder we go in.
There's the file.
And the good thing about this is you can rename it.
So we'll just call it Test.
And the only downside is this does show up as a network drive, which for 99% of
the time should not make a difference.
And also one other potential downside, is I'm not sure if some programs might
not play well with network drives, even though it's not technically a network
drive, some programs might not like it, just be aware of that, but I've
never had a problem with these other drives that are actual network drives.
And then if you want to remove these, you can just type in "net use" and
then the name and then /delete.
And then I don't know what this is saying, I guess it's open,
but we can just type in yes.
And then there, it goes way.
And also if you want to get rid of something you created with
subst, you can see that basically the /D command does that.
So let's say that I created subst L: you can just do /D
and that would get rid of it.
And if you created it with the regedit, then you would have
to just go in and delete it.
Make sure you again, don't delete the wrong thing.
But this is the one we created.
You just delet it like that.
And then on the next reboot, it will go away.
And so that pretty much covers it.
So hopefully this video taught you something new.
Let me know what you think down in the comments as he found this video useful,
and you want to subscribe, be sure to also click the bell to get notifications
because I upload about twice a week.
You don't want them to get lost in the rest of your subscriptions.
If you guys want to keep watching the next video I'd recommend very
much related to highly recommended.
It's talking about symbolic links, which kind of does this whole thing,
talked about virtual folders and stuff, but for any kind of folder on the
drive, not just for a drive letter.
So I'll put that link right there if you want to go to it.
So thanks so much for watching guys, and I'll see you in the next video.