• Copy Desktop Shortcut from One Computer to Another

    Home » Forums » AskWoody support » Windows » Windows Vista, XP and earlier » Questions: Vista, XP back to 3.1 » Copy Desktop Shortcut from One Computer to Another

    Author
    Topic
    #383258

    Copy Desktop Shortcut from One Computer to Another?

    I

    Viewing 1 reply thread
    Author
    Replies
    • #652981

      Howdy John.
      I’m not sure any of these shortcut copies will work the way you want them to or not. But to Physically move the shortcuts…

      1. Go to My Computer / 3 1/2 Floppy A: and minimize or shrink the window and drag the shortcut from the floppy to the desktop.
      2. Go to the server, navigate to the workstation where the shortcut you want resides, and copy it to the location you want to save it on the server.
      3. Again, go to the server and copy or move the shortcut back to the workstation it came from or any other workstatiion on the network.

      Shortcuts generally work best when they are created in the location that they will be used from. That way the shortcut uses the correct path to find the target. If you start moving shortcuts around to different machines, servers and workstations that’s just going to get confusing. You didn’t say what these shortcuts point to. If they point to locations on your network or individual machines, then you probably shouldn’t move them around. If they point to a webpage or a universal location then it shouldn’t cause any problems. A little more detail about the intended use or situation would help here.

      • #653568

        Hi Guys

        Thanks for the Information

        In my case I

        • #653705

          John,

          If you are sure that the targets of the shortcuts are in identically named paths on all PC’s, you should be able to store master copies of the shortcuts on a network drive and copy these down to the individual PC’s. I have done this succesfully in Windows NT4; I think Window 98 should be OK too. Take note of Drew’s precaution about Windows 2000.

          • #653825

            John,
            Have to agree with Hans here. If all paths & targets are in fact the same bullseye, a master folder or a .zip archive that you can copy on each client machine or on a network server or drive, would enable you to reinstall the icons yourself over the network, allow the client access to the network drive or folder on their system or e-mail the .zip file to a remote client in the event of an unintended deletion.

        • #653901

          FWIW, this is modified example of VBA sub that copies updated files (including desktop shortcut) from network server to local PC, using FileSystemObject (FSO) methods. To use FSO (assuming it hasn’t been disabled by your friendly IT Dept) set a reference to Microsoft Scripting Runtime (scrrun.dll) or Windows Script Host (WSH) Object Model library (wshom.ocx)). (This is for secured Access database, where the shortcut has to point to correct workgroup information file in addition to target database):

          Private Sub RunSetup()
          On Error GoTo Err_Handler

          Dim strpathUNC As String
          Dim strPathNet As String
          Dim strPathLocal As String
          Dim strPathDesktop As String
          Dim strFile As String
          Dim strFolder As String

          Dim fso As New Scripting.FileSystemObject

          strpathUNC = “SERVERNAMEGLOBALDEPTACCESSMYAPP”
          strPathNet = “G:ACCESSMYAPP”
          strPathLocal = “C:ACCESSMYAPP”
          strPathDesktop = GetDesktopPath

          ‘ Create local folder if doesn’t already exist:
          strFolder = Left(strPathLocal, Len(strPathLocal) – 1)
          If Not fso.FolderExists(strFolder) Then
          fso.CreateFolder (strFolder)
          End If

          ‘ CopyFolder method will copy folder & all files in folder to destination folder:
          strFolder = “ICONS”
          fso.CopyFolder strPathNet & strFolder, strPathLocal, True ‘Overwrite files
          ‘ CopyFile method will copy all files fm source folder to target folder:
          fso.CopyFile strPathNet & “SETUP*.*”, strPathLocal, True ‘Overwrite files
          strFile = “Shortcut to MyApp.LNK”
          fso.CopyFile strPathLocal & strFile, strPathDesktop, True

          Exit_Sub:
          Set fso = Nothing
          Exit Sub
          Err_Handler:
          ‘ Error handling here
          Resume Exit_Sub
          End Sub

          WIN API functions are used to get correct path for target PC’s Desktop folder, as shown in this example:

          Option Compare Database
          Option Explicit

          Public Type ShortItemId
          cb As Long
          abID As Byte
          End Type

          Public Type ItemIDList
          mkid As ShortItemId
          End Type

          ‘ Use one of these constants for specified folder:
          Const CSIDL_TEMPLATES = &H15
          Const CSIDL_STARTMENU = &HB
          Const CSIDL_FAVORITES = &H6
          Const CSIDL_DESKTOPDIRECTORY = &H10

          Public Declare Function SHGetPathFromIDList Lib “shell32.dll” _
          (ByVal pidl As Long, ByVal pszPath As String) As Long

          Public Declare Function SHGetSpecialFolderLocation Lib “shell32.dll” _
          (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ItemIDList) As Long

          Function GetSpecialFolder(ByVal CSIDL As Long) As String
          On Error GoTo Err_Handler

          ‘NOTE: Added ByVal to CSIDL argument or get ByRef argument type mismatch error
          Dim lngIDL As Long
          Dim strPath As String
          Dim IDL As ItemIDList
          Const NOERROR = 0
          Const MAX_LENGTH = 260

          lngIDL = SHGetSpecialFolderLocation(Application.hWndAccessApp, CSIDL, IDL)
          If lngIDL = NOERROR Then
          strPath = Space(MAX_LENGTH)
          lngIDL = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal strPath)
          If lngIDL Then
          GetSpecialFolder = Left$(strPath, InStr(strPath, Chr$(0)) – 1) & “”
          End If
          End If

          Exit_Sub:
          Exit Function
          Err_Handler:
          MsgBox Err.Description, vbCritical Or vbOKOnly
          Resume Exit_Sub
          End Function

          Public Function GetDesktopPath() As String
          GetDesktopPath = GetSpecialFolder(CSIDL_DESKTOPDIRECTORY)
          End Function

          Note that this code is used in an Access .MDE file used to update actual application files; thus the Access application hWndAccessApp function is used to provide SHGetSpecialFolderLocation hwndOwner argument. If not using Access to run this, modify code accordingly. At work we use both WIN 98 & WIN 2K and function works correctly on both. On home computer (WIN XP Home Ed) function also returns correct desktop folder for currently logged in user. Ex: C:Documents and SettingsMARK DDesktop

          Note: The API code based in part (with the usual corrections, like missing ByVal’s) on MSKB Article 182606 – ODE: How to Create a Shortcut on the Desktop with ODE

          HTH

    • #653078

      I have ‘copied’ shortcuts before, and the situation where I was doing so was when I had made a ‘custom’ shortcut, like a shortcut to a secured Access mdb file, that had command line arguments in it, to point to the correct workgroup file, and possibly even a username and password.

      Just a little warning. I know this is the Windows 98 lounge, but when you start copying shortcuts in Windows 2000, it’s a whole new ball of wax. Windows 2000 ‘marks’ its shortcuts, so that if the file they are pointing to moves, the shortcuts adapt. It’s slick, but it has issues if you send someone a shortcut. One issue, is that the shortcut actually points to the machine that made the shortcut. Not a problem if you have access to that machine, but if it is off, the shortcut won’t work.

    Viewing 1 reply thread
    Reply To: Copy Desktop Shortcut from One Computer to Another

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: