How to change bat file icon

I"d favor to recognize what"s the method to actually set the icon of a .bat file to an arbitrary icon.How would certainly I go about doing that programmatically, independently of the language I might be making use of.

You watching: How to change bat file icon


*

*

Assuming you"re referring to MS-DOS batch files: as it is ssuggest a text file with a one-of-a-kind extension, a .bat file does not save an icon of its very own.

You have the right to, yet, develop a shortcut in the .lnk format that stores an icon.


*

*

You could use a Bat to Exe converter from here:

http://www.f2ko.de/en/b2e.php

This will certainly transform your batch file to an executable, then you deserve to set the icon for the converted file.


*

You can simply develop a shortreduced and also then appropriate click on it -> properties -> readjust icon, and also just browse for your desired icon.Hope this aid.

To collection an symbol of a shortcut programmatically, check out this write-up using SetIconLocation:

How Can I Change the Icon for an Existing Shortcut?:

https://devblogs.microsoft.com/scripting/how-can-i-change-the-icon-for-an-existing-shortcut/

Const DESKTOP = &H10&Set objCovering = CreateObject("Covering.Application")Set objFolder = objCovering.NameSpace(DESKTOP)Set objFolderItem = objFolder.ParseName("Test Shortreduced.lnk")Set objShortreduced = objFolderItem.GetLinkobjShortcut.SetIconLocation "C:WindowsSystem32SHELL32.dll", 13objShortcut.Save
The symbol shown by the Covering (Explorer) for batch files is figured out by the regisattempt key

HKCRatfileDefaultIconwhich, on my computer system is

%SystemRoot%System32imageres.dll,-68You have the right to set this to any symbol you like.

This will certainly however readjust the symbols of all batch documents (unmuch less they have the extension .cmd).


One of the means you have the right to achieve this is:

Create an executable Jar fileCreate a batch file to run the above jar and also launch the desktop java application.Use Batch2Exe converter and concealed to batch file to Exe.During above conversion, you deserve to readjust the symbol to that of your choice.(must of valid .ico file)Place the brief cut for the over exe on desktop computer.

See more: Which Is Better Intel Celeron Or Intel Pentium And A Celeron Processor

Now your java regimen deserve to be opened up in a sophisticated method simply choose any kind of other MSWindows apps.! :)


If you desire an symbol for a batch file,initially create a attach for the batch file as follows

Right click in window folder wbelow you desire the linkpick New -> Shortreduced, then specify wbelow the .bat file is.

This creates the .lnk file you wanted.Then you deserve to specify an icon for the connect,on its properties page.

Some nice icons are easily accessible here:

%SystemRoot%System32SHELL32.dll

Keep in mind For me on Windows 10:%SystemRoot% == C:Windows

More Icons are here:C:WindowsSystem32imageres.dll

Also you might desire to have actually the initially linein the batch file to be "cd .."if you stash your batch files in a bat subdirectoryone level listed below where your shortcuts, are supposed to execute.


I"ll assume you are talking about Windows, right? I don"t think you can change the icon of a batch file directly. Icons are installed in .EXE and also .DLL documents, or pointed to by .LNK records.

You could attempt to adjust the file association, however that method might vary based on the version of Windows you are making use of. This is dvery own with the registry in XP, yet I"m not sure about Vista.


Try BatToExe converter. It will certainly transform your batch file to an executable, and permit you to set an icon for it.

See more: Why Does My Computer Say Someone Else Is Logged On, Fix: Someone Is Still Using This Pc


attempt with shortcutjs.bat to create a shortcut:

call shortcutjs.bat -linkfile mybat3.lnk -targain "%cd%Ascii2All.bat" -iconlocation "%SystemRoot%System32SHELL32.dll,77"you deserve to usage the -iconplace switch to suggest to a symbol .


Highly active question. Earn 10 reputation in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Not the answer you're looking for? Browse various other inquiries tagged home windows icons batch-file or ask your very own question.


How execute I gain present date/time on the Windows command also line in a suitable format for intake in a file/folder name?
site architecture / logo design © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.3.30.38947


Your privacy

By clicking “Accept all cookies”, you agree Stack Exadjust deserve to store cookies on your gadget and also discshed information in accordance via our Cookie Policy.