Find and Delete (or Create) Specified Icons in Program Files StartMenu Folder
Keywords: progman startmenu
Question:
Can anybody tell me how I can get Winbatch
to search through all of my program groups in Windows 95/NT
and find and delete (or create) specified icons?
Answer:
This is a triple problem.
- First, figure out where the start menu directory is, by doing
startdir = ShortCutDir("Startmenu")
to get the starting directory.
- Use the "SEARCHER" extender to root thru
the directories. Ignore the files, just pay attention to the directories.
- For each directory use FileItemize (not FileExist, because shortcuts confuse it) to determine if the desired LNK
file is there and if so FileDelete it.
- To create a LNK file there, use the ShortCutMake and ShortCutEdit functions
(see the WIL help file).
Question:
I'm looking for a simple example to install an icon using a WinBatch routine ... I have the ICO file , I just
need to know what to do in WinBatch to get the group/folder installed with the icon placed in it.
Answer:
Assuming you are running Windows 95 or NT 4.0:
- Create the directory you need (DirMake) under start Menu for the group you want. Directory name ==
group name. Note that it is not always c:\windows\start menu\programs\whatever. You need to look up
the programs directory in the registry at... umm...
programs=RegQueryValue(@REGCURRENT,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders[Programs]")
- Then you do a ShortCutMake to make the shortcut.
- Then you need a ShortCutExtra to add the desired ico file.
Additional notes:
If you're on NT, want to delete a specific program group under:
\profiles\userid (some user name)\startmenu\program group...
you'll need to go into the registry and search for profiles, to figure out where the
local machine user profiles are located. Then, for each *.LNK file in those groups,
you'll have to look inside the LNK and see what directory the link points to,
before blowing away the program groups, and the LNK files that point to them.
Not a trivial problem!
Article ID: W13258
Filename: Delete (or Create) Specified Icons in the StartMenu Folder.txt
File Created: 2001:05:25:12:07:48
Last Updated: 2001:05:25:12:07:48