Jump to content

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


jp10558
 Share

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?

Link to comment
Share on other sites

  • Moderators

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
    EndIf
Next

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...