?
Solved

Change .bat File Icon Using VB5

Posted on 1998-08-13
5
Medium Priority
?
2,269 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 100 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

840 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