Help with batch file

G

George

I have about 40 different shortcuts in various folders that have
the same icon, let's call it icon A. I would like to change icon
A to a different icon, icon B. I know I can make the changes
individually, shortcut by shortcut, but am wondering if a batch
file might do the trick in one full sweep. If anyone can tell me
how to create such a batch file, in other words, the various lines
needed, I would be most grateful.

T.i.a.
George

P.S. Icon A is inside an exe file, Icon B is an ico file.
 
S

Shenan Stanley

George said:
I have about 40 different shortcuts in various folders that have
the same icon, let's call it icon A. I would like to change icon
A to a different icon, icon B. I know I can make the changes
individually, shortcut by shortcut, but am wondering if a batch
file might do the trick in one full sweep. If anyone can tell me
how to create such a batch file, in other words, the various lines
needed, I would be most grateful.

T.i.a.
George

P.S. Icon A is inside an exe file, Icon B is an ico file.

Change one, copy to the other locations/replacing the existing file.
 
P

Pegasus [MVP]

George said:
I have about 40 different shortcuts in various folders that have the same
icon, let's call it icon A. I would like to change icon A to a different
icon, icon B. I know I can make the changes individually, shortcut by
shortcut, but am wondering if a batch file might do the trick in one full
sweep. If anyone can tell me how to create such a batch file, in other
words, the various lines needed, I would be most grateful.

T.i.a.
George

P.S. Icon A is inside an exe file, Icon B is an ico file.

It's fairly easy to automate the creation of icons - the VB Script file
further down will do it. However, in your case this is probably not the
answer. Since your shortcuts reside in different folders and require
different icons, it is difficult to create an automatic process. By the time
you've finished creating, debuggin and testing it, you've probable used ten
times as much time as if you had done it manually.

'Create a shortcut with VB Script
sName = "d:\Test.lnk"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
if oFSO.FileExists(sName) then oFSO.DeleteFile(sName)
Set oShortcut = oShell.CreateShortcut(sName)

With oShortcut
.TargetPath = "C:\Program Files (x86)\Microsoft
Office\OFFICE11\Excel.exe"
.arguments = ""
.Description = "Excel Launcher"
.IconLocation = "e:\Technical\Icons\progman15.ico"
.HotKey = "Alt+Shift+A"
.Save
End With
 
T

thanatoid

I have about 40 different shortcuts in various folders that
have the same icon, let's call it icon A. I would like to
change icon A to a different icon, icon B. I know I can
make the changes individually, shortcut by shortcut, but am
wondering if a batch file might do the trick in one full
sweep. If anyone can tell me how to create such a batch
file, in other words, the various lines needed, I would be
most grateful.

T.i.a.
George

P.S. Icon A is inside an exe file, Icon B is an ico file.

The simpler way, and if you only have a few icons to deal with,
is this:

Search in the registry for the types of files using icon A. (I
will /assume) they are all the same kind of file, although it
does raise a variety of questions, like HOW did they all end up
the same. IME, most icons which are the same are basic system
icons and changing them might not be a good idea.)

Change the icon data for that file extension to "c:\windows\SOME
DIR OR JUST ROOT\iconB.ico" (or somewhere else, or even one of
the few icons in a small DLL file as described in my previous
post).

Still has to be done manually. Making even a small DLL file has
the advantage of keeping most of it in one place. Anytime you
reinstall the system or some (usually) MS program messes with
it, you MAY have to do it again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top