This post is a short novel, so bear with me...

I'd like to find an effective way to manage a set of shortcuts that point to network locations (e.g. \\server-name\folder) that technically aren't just generic shortcuts (i.e. *.lnk files), which will ask me for credentials if needed. I have come up with a viable solution, but wanted to run my ideas (and "solution") by this community to see if there is a better way.

So first off, creating a generic shortcut (a *.lnk file) to the network locations works great, and the only reason I'm looking for an alternative is for use with the StandaloneStacks application (which emulates OSX shortcut stacks on Windows). With folder shortcuts, it attempts to drill down the folder structure, when instead I'd like it to simply show me the root folder in Explorer.

Anyway, some more requirements: I'm not allowed to join the domain. I'm stuck poking around the network by authenticating against each machine as needed. In addition, my network password expires every month so I don't want Windows to permanently remember my credentials or I'll get locked out (3 strikes you're out).

My first thought was to simply use explorer.exe to launch the network location in an Explorer window, like so:

explorer.exe /e,/root,"\\server-name\folder"

This works pretty well, but only when I've already been authenticated against the server and Windows is remembering my credentials. If I'm not already authenticated, running that command will take me to my home directory (e.g., C:\Users\Me\).

I thought about wrapping this with a runas with my network account:

runas.exe /netonly /user:domain\user "explorer.exe /separate,/e,/root,\\server-name\folder"

Ignoring the fact that I'd have to type my password every single time I wanted to launch a shortcut, this got me closer, except Windows doesn't pass the credentials in the manner I expected; it always shows an authentication failed message ("Unknown user name or bad password"). Due to my rapidly expiring passwords I'd rather not pipe in my password.

After some more digging I discovered the built-in start command. I can simply put the following in a batch file and it will do what I want:

start /max "Folder Title" \\server-name\folder

This will launch explorer in a maximized window, take me to the folder, and ask for credentials if it's the first time logging in during my Windows session. The most annoying part is the flashing of the command prompt before it launches the folder. I tried setting the command window to run minimized, but then it also minimizes the prompt for credentials.

My solution so far is that I have a folder full of little batch files with start commands pointing to all of the locations on the network I frequently visit. I then created shortcuts to these batch files with prettier icons for use with StandaloneStacks.

So, aside from writing my own little utility to launch shortcuts to network locations, are there any other built-in things in Windows that would work and might be simpler than I what I settled on? I'm using 64-bit Windows 7.

Other caveats: I jump around from client to client so I can't permanently configure my machine in any way. This rules out creating network locations to the folders I'd like and then creating magic shortcuts to them (using their GUIDs). It also sort of rules out just adding bookmarks in Explorer to these locations (the stacks features is nice, such that I don't have to launch explorer and then pick a shortcut, but that isn't such a bad idea).

  • Could you use NET USE? – Canadian Luke Oct 3 '11 at 22:19
  • @Luke: That might be an option (i.e. mapping drives) if I can prevent it from running on password change days. More than 3 incorrect logins and my account gets locked, and there are definitely more than 3 drives to map. I see you can have it prompt you for a password, but I don't want to type it 10 times. I could probably go with a batch script to collect the password and (re)map all the drives with it... – Cᴏʀʏ Oct 4 '11 at 20:49

So what you can do then is run a batch file similar to the one below:

@echo off
net use z: \\server\folder1 /user:jonsmith * /persistent:no
net use y: \\server\folder2 /persistent:no
net use x: \\server2\folder3 /user:jsmith * /persistent:no

This will ask for the password JUST when you first connect to it. Since you can't connect to the same server with multiple usernames, as soon as you authenticate the first time on the server, it will use that username and password for the rest of the connections until you disconnect all the drives or log off

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.