Jump to content
Sign in to follow this  

Creating lots of shortcuts to network shares that may not be there

Recommended Posts


So I have a need to create a bunch of shortcuts in a user logon script to network shares that may or may not be accessible. The problem I'm having is for my 15 or so shortcuts, it's taking 9 minutes to create all of them. I don't know why, I'm guessing Windows timeouts on the shares that aren't there. Is there a quicker way to create these shortcuts than FileCreateShortcut, or some flag to just create all of them in parallel?

Share this post

Link to post
Share on other sites

Why not first check for the directory on the share, and then create your shortcut? Something like this:

Local $aArray[5] = ["N:\Share", "H:\", "I:\IS", "T:\Bridger", "W:\Information Services"]
Local $x = 1

For $sDir In $aArray
    If FileExists($sDir) Then
        FileCreateShortcut($sDir, @DesktopDir & "\Shortcut " & $x)
        $x +=1

√-1 2^3 ∑ π, and it was delicious!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.