How to change the icon of .bat file programmatically?

前端 未结 10 617
予麋鹿
予麋鹿 2021-02-05 00:45

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 t

10条回答
  •  误落风尘
    2021-02-05 01:10

    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:

    %SystemRoot%\System32\SHELL32.dll

    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.

提交回复
热议问题