Solved

Change .bat File Icon Using VB5

Posted on 1998-08-13
5
2,217 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 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

21 Experts available now in Live!

Get 1:1 Help Now