WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Icons

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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.
  1. First, figure out where the start menu directory is, by doing
    
    startdir = ShortCutDir("Startmenu")
    
    to get the starting directory.

  2. Use the "SEARCHER" extender to root thru the directories. Ignore the files, just pay attention to the directories.

  3. 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.

  4. 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:
  1. 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]")
    

  2. Then you do a ShortCutMake to make the shortcut.

  3. 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