How to read the shorcut file?

Microsoft Windows vista ultimate w/ sp1...
August 31, 2009 at 05:03:17
Specs: Windows Xp, 12

Hi
For long path directories, I'm creating shortcuts and storing
all these shortcuts in the bin directory say C:\bin. I have
included this in the PATH variable so that i can easily open any
long directory by just typing the shortcut name in the Run dialog.
Now, all our files have been moved to another server with the
same directory structure. I need to modify all the shorcut(s) urls
to point to the new server. I thought of editing the shortcut(s)
file but it happens to be a binary file. Can someone help me in doing
this?..
e.g.
Old shortcut to Learning folder
Shortcut file name : learn
Path : \\Lan01\Execution\Project01\All members\Common\Learning\

New shortcut to Learning folder
Shortcut file name : learn
Path : \\$DATA\FY2009_2010\All_Projects\Project01\All members\Common\Learning\


See More: How to read the shorcut file?

Report •


#1
August 31, 2009 at 06:07:23
Are you saying that you can't change the path in the target box of the shortcut properties? What happens if you right click on the shortcut & go to properties? You should still see a target box.

How do you know when a politician is lying? His mouth is moving.


Report •

#2
August 31, 2009 at 06:27:10
hi guapo,
Thanks for the reply. Yes, I can do that by clicking the properties and
editing the url.But I have so many shortcuts in my bin folder like
learn,team,forecast,sql,backup,dev,qa,prod,etc..
If all the shortcut files are of ascii
type I can do a simple search and replace for all the files. Since the
file is binary type I have to do the replacement manually. Some months
later the fileserver may be changed again. So I thought if this is
done by some DOS scripts it would be very helpful and hence
posted this question.

Report •

#3
August 31, 2009 at 07:07:10
http://www.microsoft.com/technet/sc...

That should get you started.

How do you know when a politician is lying? His mouth is moving.


Report •

Related Solutions

#4
August 31, 2009 at 08:27:44
hi guapo,
Thanks a lot for the link. I am able to modify a single
url as mentioned in the sample code but struck in doing
for all the files in my $BIN directory.
Can you please help me completing this piece for the
commented code "##"

Const MY_DESKTOP = &H10&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_DESKTOP)

Set objFolderItem = objFolder.ParseName("gen.lnk")
Set objShellLink = objFolderItem.GetLink

##check the objShellLink. If "\\Lan01\Execution\" string is
##found replace it with "\\$DATA\FY2009_2010\All_Projects"
##else leave it as it is
objShellLink.Path = "Newpath"
objShellLink.Save()

##Close the for loop


Report •

#5
August 31, 2009 at 11:26:44
Let be direct you to people who would know for sure. There is a forum at www.minasi.com
Go to the scripting section & post there. You'll get a better answer & a lot faster.

How do you know when a politician is lying? His mouth is moving.


Report •

#6
August 31, 2009 at 13:49:04
guapo: You'll get a better answer & a lot faster.
Hey now, if he posted in the Programming forum, as he should have, he would have gotten his answer, wouldn't he?

He's just lucky I saw this post.

Const oldDir = "\\Lan01\Execution"
Const newDir = "\\$DATA\FY2009_2010\All_Projects"
Const shortcutDir = "C:\Bin"

Set shell = CreateObject("Shell.Application")
For Each f In shell.NameSpace(shortcutDir).Items
  If f.IsLink Then
    Set link = f.GetLink
    link.Path = Replace(link.Path, oldDir, newDir, 1, -1, 1)
    link.Save
  End If
Next 'f


Report •


Ask Question