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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing EXE's path on 100's PC's...efficiently?!

Status
Not open for further replies.

sciclunam

Programmer
Oct 12, 2002
138
MT
Hi all,

Hope someone can help me with this.

I have been given the (tedious) task to go to all our company's computers and replace the path of all application shortcuts we have created ourselves. We will be changing the name of the server/drive and folders and this is why we need to do this.

However not all pc's have all the same shortcuts because they have different applications. I thought of doing this through the login script. My question is:

How can I search the exisiting shortcuts on the desktop and start menu and if found be replaced by the new ones?

Thanks

Mario

Getting married in Malta?
Visit http:
 
What have you so far ?
You may consider the following objects:
WScript.Shell, Scripting.FileSystemObject
and the following methods/properties:
ExpandEnvironmentStrings, SpecialFolders, CreateShortcut

Hope This Help
PH.
 
HI,

I am new to scripting and because of the many different of combinations of applications and pc's we think of doing it manually or sending a batch file to copy respective shortcuts by email to particular persons so that we can distinguish what s.cuts should be copies on what pc.s.

Thanks for your help

Getting married in Malta?
Visit http:
 
I was faced with a similar problem. Here was my solution. Save the code below to a text file. Call it icons.hta and you are in business for making new icons witht he path you specify. Just have your users delete the old ones.



<html>
<head>
<script language=vbscript>
Sub MakeIcon(ByVal typ)

On Error Resume Next
set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
set WshShell = CreateObject(&quot;Wscript.Shell&quot;)
set WshNet = CreateObject(&quot;Wscript.Network&quot;)


' trim down user name.


NoGo = False
Select Case typ

Case 1
targ = &quot;C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE&quot;
strLnk = &quot;\Access.lnk&quot;
Case 2
targ = &quot;C:\Program Files\Microsoft Office\Office10\Excel.EXE&quot;
strLnk = &quot;\Excel.lnk&quot;
Case 3
targ = &quot;C:\Program Files\Microsoft Office\Office10\POWERPNT.EXE&quot;
strLnk = &quot;\PowerPoint.lnk&quot;
Case 4
targ = &quot;C:\Program Files\Microsoft Office\Office10\WINWORD.EXE&quot;
strLnk = &quot;\Word.lnk&quot;

Case 5
targ = &quot;C:\Winnt\System32\Calc.EXE&quot;
strLnk = &quot;\Calculator.lnk&quot;
Case 6
targ = &quot;C:\Winnt\defptr.exe&quot;
strLnk = &quot;\DefaultPrinter.lnk&quot;
Case 7
targ = &quot;C:\Program Files\Winzip\Winzip32.EXE&quot;
strLnk = &quot;\Winzip.lnk&quot;
Case 8
targ = &quot;C:\Program Files\Other1\Other1.EXE&quot;
strLnk = &quot;\Other1.lnk&quot;
Case 9
targ = &quot; strLnk = &quot;\other2.url&quot;

Case Else
NoGo = True
End select

If NoGo = False Then
strDsk = WshShell.SpecialFolders(&quot;Desktop&quot;)
strshortcut = strDsk & strLnk
If Not fso.FileExists(strshortcut) Then
set oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = targ
oUrlLink.Save
End If
End If

End Sub



</script>
</head>

<body bgcolor=&quot;#3E6DA5&quot;>
<p align=&quot;center&quot;><center>
<H1>Desktop Icons</H1></center></p>
<div align=&quot;center&quot;>
<center>

<H1><font color=&quot;#FFFFFF&quot;>Want Desktop Icons?&nbsp; Pick and choose which ones you want using the buttons below.</font></H1>

<table cellpadding=&quot;3&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; style=&quot;border-collapse: collapse&quot; bordercolor=&quot;#FFFFFF&quot; cellspacing=&quot;0&quot; border=&quot;4&quot;>
<tr>
<td bgcolor=&quot;#7B97E0&quot; align=&quot;center&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#000066&quot; bordercolor=&quot;#FFFFFF&quot;>
<form name=shrtcut method=&quot;GET&quot;>
<center>
<br>
<font color=&quot;#FFFFFF&quot;><b>MS Office Applications</b></font><br><hr>
<input type=&quot;button&quot; value=&quot;Access&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(1)&quot;>
<input type=&quot;button&quot; value=&quot;Excel&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(2)&quot;>
<input type=&quot;button&quot; value=&quot;PowerPoint&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(3)&quot;>
<input type=&quot;button&quot; value=&quot;Word&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(4)&quot;><br><br>
<font color=&quot;#FFFFFF&quot;><b>Utilities</b></font><br><hr>
<input type=&quot;button&quot; value=&quot;Calculator&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(5)&quot;>
<input type=&quot;button&quot; value=&quot;Default Printer&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(6)&quot;>
<input type=&quot;button&quot; value=&quot;Winzip&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(7)&quot;><br><br>
<font color=&quot;#FFFFFF&quot;><b>Other Applications</b></font><br><hr>
<input type=&quot;button&quot; value=&quot;Other1&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(8)&quot;>
<input type=&quot;button&quot; value=&quot;Intranet Application&quot; name=&quot;typ&quot; onclick=&quot;MakeIcon(9)&quot;>


</center>
</form>
</tr></td>
</table>

Need more icons? E-Mail Tech-Support for an updated icon file.
</center>
</div>

</body></html>
 
sciclunam:

check out:
You'll need to check the TargetPath property for your old path value and change it to your new path.

ie:
from: TargetPath = &quot;C:\MyData\Old\Path\MyFile.exe&quot;
to: TargetPath = &quot;C:\YourData\New\Path\MyFile.exe&quot;

Since users can map a drive to any letter they like you should retain the drive letter and only replace the part of the path that got changed.

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top