16

Following on from this question about opening file explorer as a different user, I've tried navigating to C:\Windows, shift+right-clicking explorer.exe and clicking "Run as different user". When I enter the login details of the user, I get 2 successive error messages, both of which say

Windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the item

If I try the login details of the account that's currently logged in, it works, but the other doesn't. This is the case for both accounts (admins) on my PC.

Edit

There has been some confusion in the comments. I'm trying to follow the accepted answer in the question linked above, and it's not working. Some people are saying it can't be done, so it's odd that there is an accepted answer with multiple upvotes (Edit 2: well, my comment on that answer saying it doesn't work now has more upvotes than the answer itself!).

binaryfunt
  • 1,007

4 Answers4

15

Per this TechNet Blog Post, explorer.exe looks to be single threaded and won't allow multiple threads running under different user accounts:

Windows Explorer was not designed to run in multiple security contexts in the same desktop session, Windows cannot simply throw up a UAC prompt and then launch an elevated instance of Explorer

The most useful alternative to using explorer.exe, as also outlined in that article, is to download explorer++ and run that as the user you wish to browse files as. You can connect to UNC paths just as easily in explorer++ as you would with explorer, so it seems to be a sufficient alternative. This is also the easiest approach I've come across that doesn't require elevated permissions (such as those needed to meddle in the registry or install additional software).

3

An interesting workaround that I recently discovered myself, and nobody here has yet mentioned:

Spawn any process/program as a different user (e.g. Notepad), and depending on the program and the framework used, you can use the Common File Dialog Box API to do a lot of regular "explorer" shell operations.

(Simply select Save as.. or Open... from the menu, and use context menu to perform copy/paste, etc., then "cancel" the dialog).

How to run as different user in the first place

To spawn any program as a different user, use the sysinternals shellrunas, which can install a context-menu item. Alternatively, spawn a cmd with builtin Windows runas, then start a program that uses a Common File Dialog Box API.

2

From what you can read in other questions (1,2) regarding this topic it's usually hacky at best and certainly not a supported scenario. Further more the second question has some more information and if you follow a few links you'll end up here: And so this is Vista…

If you check that article you'll read the following:

On Vista, however, there are more changes. Neither Internet Explorer nor Windows Explorer is willing to entertain multiple accounts on the same desktop. If you try to run IE under a different user account from that of the desktop, it will display an error message: “The RUNAS command is not supported.” As I understand it, the primary reason is that with Protected Mode Internet Explorer, which runs at Low Integrity Level, IE also launches a Medium IL broker process (ieuser.exe) which runs as the desktop user and which gates selected Medium IL operations for the Low IL process. Allowing multiple identities into that mix would have introduced significant complexity best avoided. If you try to run Windows Explorer as a different user, you’ll see nothing – the new process starts but exits without displaying a window.

...

Explorer is a little trickier. Directly applying “Run as administrator” won’t do it, but running it from an elevated command shell often will. I find that a command line like “explorer /e,c:\” will work, while just running “explorer” might not. But as before: if it works at all, it is an unintentional side effect of the current implementation, and is subject to change at any time.

It's reasonable to expect them to keep this behavior as they had it in Windows Vista, Windows 7, Windows 8 and now (probably) Windows 10.

So it seems you'll either have to use a hack, consider a workaround, or reevaluate your problem that leads to you having to run an explorer as a different user.

As a workaround you could use a different file explorer like Total Commander, a cmd that is running under different credentials, a file open dialog of some other software you started as a different user or the windows "fast switch" to just temporarily switch to the other user.

You didn't really provide any information why you're trying to do this so I have no idea what a different approach could look like and as for the hack ... there are multiple in the questions above. My guess why the one you linked in your initial question was masked as solved is that the person did some more research and maybe stumbled upon on of those hacks.

Seth
  • 9,393
2

Setting Explorer to open folders in separate processes used to allow this to work under 1511. E.g. at a command prompt running as user1, "explorer c:\somePath" would open an Explorer window running as user1, while from a command prompt running as UserZ, the same command would open an explorer window running as UserZ.

After upgrading to 1607, that broke. Right-click and run as different user results in the same errors stated above.

Launching explorer from the command prompt, no window is ever displayed, but a new explorer process owned by the currently logged in desktop user. That process eventually goes away on its own. I have watched a couple of times where the new explorer process launches as the user that invoked it, then that process immediately closes, and a new process owned by the desktop user is spawned (and never shows up, and after a bit is automatically killed). I suspect this is always the case, just usually happening too quickly to observe in Task Manager. Process Monitor or something similar would probably help proving this, but I haven't bothered, since I probably can't fix it anyway. :\