How to change the icon of a batch file

I"d like to recognize what"s the means to actually set the icon of a .bat file to an arbitrary symbol.How would certainly I go about doing that programmatically, individually of the language I might be utilizing.

You watching: How to change the icon of a batch file


*

*

Assuming you"re referring to MS-DOS batch files: as it is ssuggest a text file through a special extension, a .bat file does not store an symbol of its own.

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


*

*

You might usage a Bat to Exe converter from here:

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

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


*

You can just create a shortcut and also then best click on it -> properties -> adjust icon, and also simply browse for your desired icon.Hope this help.

To set an symbol of a shortreduced programmatically, watch this write-up making use of 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 objShell = CreateObject("Shell.Application")Set objFolder = objShell.NameSpace(DESKTOP)Set objFolderItem = objFolder.ParseName("Test Shortreduced.lnk")Set objShortreduced = objFolderItem.GetLinkobjShortcut.SetIconLocation "C:WindowsSystem32SHELL32.dll", 13objShortcut.Save
The symbol displayed by the Covering (Explorer) for batch records is identified by the regisattempt key

HKCRatfileDefaultIconwhich, on my computer is

%SystemRoot%System32imageres.dll,-68You have the right to collection this to any type of symbol you favor.

This will but adjust the symbols of all batch files (unless they have the expansion .cmd).


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

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

See more: Publisher Cannot Save The File S As Pdf, Publisher Cannot Save File

Now your java program have the right to be opened up in a sophisticated method just choose any kind of other MSWindows apps.! :)


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

Right click in window folder where you desire the linkselect New -> Shortcut, then specify where the .bat file is.

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

Some nice symbols are available here:

%SystemRoot%System32SHELL32.dll

Note 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 below where your shortcuts, are meant to execute.


I"ll assume you are talking about Windows, right? I do not think you deserve to readjust the icon of a batch file straight. Icons are installed in .EXE and also .DLL records, or pointed to by .LNK files.

You could try to readjust the file association, but that method might differ based on the variation of Windows you are utilizing. This is down via the regisattempt in XP, however I"m not sure about Vista.


Try BatToExe converter. It will convert your batch file to an executable, and also enable you to set an icon for it.

See more: Close Programs To Prevent Information Loss Windows 10, Windows 10 Low On Memory, But It'S Not


attempt through shortcutjs.bat to create a shortcut:

contact shortcutjs.bat -linkfile mybat3.lnk -targain "%cd%Ascii2All.bat" -iconplace "%SystemRoot%System32SHELL32.dll,77"you can use the -iconplace switch to suggest to a icon .


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

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


How do I get present date/time on the Windows command line in a perfect format for usage in a file/folder name?
website style / logo © 2021 Stack Exadjust Inc; user contributions licensed under cc by-sa. rev2021.3.29.38936