Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

link to the desktops

Status
Not open for further replies.

peljo

Technical User
Mar 3, 2006
91
BG
Can i create a link by code to the destops of different computers having a path in the main computer for example "C:\ Mansions \ dorns.mdb
 
Do you mean:

Code:
Sub CreateShortcut()
'Modified from:
'The Create Shortcut command truncates the source path folder names to eight characters
'[URL unfurl="true"]http://support.microsoft.com/kb/263324#appliesto[/URL]

Set WshShell = CreateObject("WScript.Shell")
Dim ret
'subst a drive to make the mapping work
ret = WshShell.Run("cmd /c subst j: c:\", 0, True)
Set oShellLink = WshShell.CreateShortcut("d:\" & "\Long filename Shortcut .lnk")
oShellLink.TargetPath = "j:\my long directory\myapplication.exe"
oShellLink.WindowStyle = 1
'Icon, if required
oShellLink.IconLocation = "C:\Program Files\Microsoft Office\Office\MSAccess.exe, 0"
oShellLink.Hotkey = "CTRL+SHIFT+F"
oShellLink.Description = "Long Filename Shortcut"
'This will overwrite the existing Icon
oShellLink.Save
'remove the subst
ret = WshShell.Run("cmd /c subst j: /d", 0, True)

End Sub
 
Your "main computer" must have an ID on your network (i.e. in my company, it's E122900) and have the folder in question "shared".

Then the file path in the shortcut would look like this:

\\E122990\Mansions\dorns.mdb

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top