I'd like to know what's the way to actually set the icon of a
.bat file to an arbitrary icon.
How would I go about doing that programmatically, independently of the language I may be using.
This question is tagged with
~ Asked on 2008-08-19 00:21:12
Assuming you're referring to MS-DOS batch files: as it is simply a text file with a special extension, a
.bat file doesn't store an icon of its own.
You can, however, create a shortcut in the
.lnk format that stores an icon.
~ Answered on 2008-08-19 00:37:11
You could use a
Bat to Exe converter from here:
This will convert your batch file to an executable, then you can set the icon for the converted file.
~ Answered on 2011-01-07 13:46:48
You can just create a shortcut and then right click on it -> properties -> change icon, and just browse for your desired icon. Hope this help.
To set an icon of a shortcut programmatically, see this article using
How Can I Change the Icon for an Existing Shortcut?:
Const DESKTOP = &H10& Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.NameSpace(DESKTOP) Set objFolderItem = objFolder.ParseName("Test Shortcut.lnk") Set objShortcut = objFolderItem.GetLink objShortcut.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13 objShortcut.Save
~ Answered on 2013-02-04 13:35:12
The icon displayed by the Shell (Explorer) for batch files is determined by the registry key
which, on my computer is
You can set this to any icon you like.
This will however change the icons of all batch files (unless they have the extension
~ Answered on 2009-05-13 07:58:24
If you want an icon for a batch file, first create a link for the batch file as follows
Right click in window folder where you want the link select New -> Shortcut, then specify where the .bat file is.
This creates the .lnk file you wanted. Then you can specify an icon for the link, on its properties page.
Some nice icons are available here:
Note For me on Windows 10: %SystemRoot% == C:\Windows\
More Icons are here: C:\Windows\System32\imageres.dll
Also you might want to have the first line in the batch file to be "cd .." if you stash your batch files in a bat subdirectory one level below where your shortcuts, are supposed to execute.
~ Answered on 2018-01-31 23:38:54
One of the way you can achieve this is:
Now your java program can be opened in a fancy way just like any other MSWindows apps.! :)
~ Answered on 2010-10-19 06:00:56
Try BatToExe converter. It will convert your batch file to an executable, and allow you to set an icon for it.
~ Answered on 2013-09-23 12:31:53
I'll assume you are talking about Windows, right? I don't believe you can change the icon of a batch file directly. Icons are embedded in .EXE and .DLL files, or pointed to by .LNK files.
You could try to change the file association, but that approach may vary based on the version of Windows you are using. This is down with the registry in XP, but I'm not sure about Vista.
~ Answered on 2008-08-19 00:35:56
try with shortcutjs.bat to create a shortcut:
call shortcutjs.bat -linkfile mybat3.lnk -target "%cd%\Ascii2All.bat" -iconlocation "%SystemRoot%\System32\SHELL32.dll,77"
you can use the -iconlocation switch to point to a icon .
~ Answered on 2020-11-09 19:38:29
i recommand to use BAT to EXE converter for your desires
~ Answered on 2018-03-18 11:30:17