Subst drive invisible in non-admin processes

5,284

If you want to "map" the folders with subst and use an "administrator instance" of a program, you must do the "subst" as administrator too. Easy ;)

Right clic on your ShortCut and clic on "Run as Admin..."

Share:
5,284

Related videos on Youtube

xxbbcc
Author by

xxbbcc

Updated on September 18, 2022

Comments

  • xxbbcc
    xxbbcc almost 2 years

    I have a local folder, X:\Source\Q_Project that I want to map to the Q: drive letter. I use a shortcut that points to a batch file for this. The batch file is:

    @echo off
    subst q: /d
    subst q: X:\Source\Q_Project
    

    This worked just fine in Windows 7 Ultimate 64-bit - I was able to see the Q: drive from Windows Explorer and from any other 32/64-bit program, including the console, etc.

    Under Windows 8 Home 64-bit, this no longer works. I have UAC off (only through the UI so it's not really, really off but warnings are off anyway). The shortcut is set to run as administrator under the Properties->Shortcut tab.

    When I double-click the shortcut, the batch file executes and the Q: drive is visible from one particular program, Far Manager (32-bit console application, running as administrator). If I launch a process through Far Manager, that process also sees the Q: drive. Anything that I try to launch through File Explorer or other desktop shortcuts don't see the subst'd drive. If I run a shortcut with Run as administrator, those programs will see the Q: drive.

    This is driving me crazy - is there a way to fix this in this sorry excuse of an OS? Windows 7 worked perfectly with this (I was running as an actual admin under Windows 7 but under Windows 8 I'm trying to see if it's possible to do it 'right' - so far this seems to fail, I keep having to run everything as an admin).

    Is the only option to truly turn off UAC and run as an actual admin? I know it'll kill all Metro apps but that's fine by me.

    Note: a permanent mapping through the registry won't work for me (I have one of those, too). I need to be able to re-map the Q: drive frequently to different source code repositories without having to log off / restart.

    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 almost 11 years
      what you are seeing is no different than 7 or even Vista -- when you run something "As administrator" then it runs in the Administrator's context, and not the user's. Anyhow, what's the ACTUAL problem you're trying to solve? Why not just map/subst Q: as the current user?
    • David Marshall
      David Marshall almost 11 years
      With UAC on you get 2 contexts, the filtered standard user and the elevated user. The subst command is only effective for the context it was issued in. You would need to run the subst as standard user. What is the reason you run the shortcut as administrator?
    • xxbbcc
      xxbbcc almost 11 years
      @DavidMarshall I need that because most of my programs need to run as administrator - Visual Studio, Far Manager, etc. I try to run as few programs as admin as I can but that only applies to Office programs. I'm an engineer and most of my programs need to run as admin.
    • xxbbcc
      xxbbcc almost 11 years
      @techie - I need to access my Q: drive from both the standard and the elevated processes. It seems like the only solution is to truly nuke UAC through the registry.
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 almost 11 years
      Or subst it twice, once for the user context you're using, and once for the administrator user's context. PS: I run VS in regular user mode all the time - helps you from making programs that require Admin privileges without realizing it. ;) Perhaps you should consider changing your processes instead of trying to circumvent OS security.
    • David Marshall
      David Marshall almost 11 years
      @xxbcc What happens if you run the subst twice; once as Administrator and once as Standard User. I've heard Microsoft personnel say that no testing of Windows 8 with UAC off is done. So turning UAC off really is a last resort.
    • xxbbcc
      xxbbcc almost 11 years
      @DavidMarshall I haven't tried that, I'll see if that works.
    • xxbbcc
      xxbbcc almost 11 years
      @techie007 That's why I haven't actually turned UAC off, just turned off the UI notifications. But I have a number of programs (the projects I work on, too) that require constant admin access.
    • Ben N
      Ben N almost 7 years