Subst Drive On Startup Cannot Be Found While in Admin Cmd (Windows Cmd)

1.8k views Asked by At

I have a .bat file in my startup folder that is creating a new drive via the command subst W: D:\WorkDrive

When I access a command prompt running as admin I cannot find the specified drive. While if I was to run the same command on a non-admin cmd I am able to locate the drive as shown here.

Administrator command prompt that is unable to locate virtual drive W: Administrator command prompt that is unable to locate virtual drive W:

Non-Admin command prompt that is able to locate virtual drive W: Non-Admin command prompt that is able to locate virtual drive W:

Neither of these command prompts are started with any options, these are just the base cmd one ran in admin and one not. I am unsure why this would be the case, but I would really like to be able to have admin permissions and be able to access drive W:

1

There are 1 answers

1
Chris McCole On

As per Eryk Sun's comment:

With UAC, an administrator account is logged on with two logon sessions -- standard and elevated administrator. If you're creating the drive locally for just you, then you can use Task Scheduler to run subst.exe W: D:\WorkDrive twice, triggered at logon, once for the standard logon and once for the elevated logon session. Or run the command as SYSTEM at startup to define the drive globally.