Solved

Change .bat File Icon Using VB5

Posted on 1998-08-13
5
2,216 Views
Last Modified: 2012-05-04
How do you change a .bat file icon using VB?
0
Comment
Question by:Root
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now