Jump to content

changing icon for a .cmd file


jbm

Recommended Posts

I have a shortcut that runs a .cmd file that

runs and .exe file with some command line options.

The icon shows the normal icon for .cmd files.

I can right click on it and choose change icons

and browse to the .exe file and change to the icon

in that .exe file.

Is there any way I can do this during an unattended

setup?

I've tried using regmon, setting the include string

to different values but didn't see anything helpful.

Link to comment
Share on other sites


The only way to do it is to hack the Cmd.exe it self.

I have changed the icon on this one

Hacked Cmd.exe

Thanks for the reply.

So now I need to extract the icon from the exe than add it to

a cmd.exe using the one of the tools on this site.

Looks like its time for me to do some more searching.

Link to comment
Share on other sites

I was able to change the icon in a copy of cmd.exe to the one I want

using resedit and an icon editor. But if I replace the original cmd.exe

with that one all bat files will show that icon right?

So how do I make one bat file display a different icon than others.

Is this possible.

Link to comment
Share on other sites

Thanks gunsmokingman and Incroyable HULK

I ended up using AutoIT, when I tried to use Reshacker it said my .bat

file was not a 32bit executable and wouldn't open it.

P.S I bunged up my iexplorer icon and others using a program

called reseditor I found in this forum. Don't know if its

something I did wrong or not. But searching the registry showed

about 150 places where defaulticon points to where reseditor is

installed. Tried a repair install but that didn't fix it.

Oh well I need to really test my unattended CD.

Link to comment
Share on other sites

This vbs file will create a shortcut named MyLink in %systemdrive% pointing to %windir%\a.cmd with the icon from regedit.exe

'Shortcut.vbs

set WshShell = WScript.CreateObject("WScript.Shell")

Path1 = WshShell.ExpandEnvironmentStrings("%systemdrive%")

Path2 = chr(34) & "%windir%\a.cmd" & chr(34)

set oShellLink = WshShell.CreateShortcut(Path1 & "\MyLink.lnk")

oShellLink.TargetPath = Path2

oShellLink.WindowStyle = 1

oShellLink.IconLocation = "regedit.exe,0"

oShellLink.Description = "MyLink"

oShellLink.WorkingDirectory = sPath

oShellLink.Save

Link to comment
Share on other sites

Thanks gunsmokingman and Incroyable HULK

I ended up using AutoIT, when I tried to use Reshacker it said my .bat

file was not a 32bit executable and wouldn't open it.

P.S I bunged up my iexplorer icon and others using a program

called reseditor I found in this forum. Don't know if its

something I did wrong or not. But searching the registry showed

about 150 places where defaulticon points to where reseditor is

installed. Tried a repair install but that didn't fix it.

Oh well I need to really test my unattended CD.

You have to open cmd.exe in ResHacker, not your .bat file. And if you just want to change the icon of the shortcut, it's not neccesary to hack cmd.exe. Nakira's method will be enough.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...