Solved

Change .bat File Icon Using VB5

Posted on 1998-08-13
5
2,227 Views
Last Modified: 2012-05-04
How do you change a .bat file icon using VB?
0
Comment
Question by:Root
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Expert Comment

by:Olli083097
ID: 1468773
You can change the value in the register!
The value is located under HKEY_CLASSES_ROOT\batfile\DefaultIcon
the default value is: C:\WINDOWS\SYSTEM\shell32.dll,-153
But you can change this to the icon you want!
0
 

Author Comment

by:Root
ID: 1468774
I don't want to change the icon for all .bat files but merely certain ones.
0
 

Expert Comment

by:Olli083097
ID: 1468775
Is it for .bat files with a certain name, like start.bat?
0
 

Author Comment

by:Root
ID: 1468776
No, they will have different names.  In addtiion, they will each need to have a different icon.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 50 total points
ID: 1468777
Oke, it can be done but it is a littlebit tricky and it involves the registry.

With @=  I mean that your should enter this as value for the folder.

HKEY_CLASSES_ROOT\CLSID\{6465F040-4381-1090-9F32-00AA002F954E}\DefaultIcon
~@=location of icon file or dll name like shell32.dll,153 or c:\temp\icon1.ico
HKEY_CLASSES_ROOT\CLSID\{6465F040-4381-1090-9F32-00AA002F954E}\Shell\Open\Command
@="%1" %*

Rename your batfile to <name>.bat.{6465F040-4381-1090-9F32-00AA002F954E}

Note that the {..} will disappear and the icon will change.
--
Another solution is to make a copy of the registry information under batfile to batfile1. Now change the defaulticon value of batfile1.
Enter a new key under classes root called .bat1 with value batfile1.
Rename your bat file to <name>.bat1
--


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question