Associate With - Batch files with incorrect icon

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Aezay
Senior Member
Senior Member
Posts: 269
Joined: 2003-02-12, 07:27 UTC
Location: Denmark
Contact:

Associate With - Batch files with incorrect icon

Post by *Aezay »

Since batch files didn't have an icon in TC, and explorer showed them correct, I selected a *.bat file and chose the "Files" -> "Associate With". Now the 1st problem occurs, it didn't select the bat file for me, I had to type bat myself (what a task :lol:).
Now i edited the type, chose the "Change icon" button, selected the icon for bat files, pressed ok, and ok again. Now I was back in the "Associate With" dialog, but I wasn't allowed to close the dialog, cause it gave me the error that "A program cannot be associated with another program!".

Before and after I did this I manually checked what the value in "HKCR\batfile\DefaultIcon\" was. Before it was an expanded string set to "%SystemRoot%\System32\shell32.dll,-153". After it was the string "%SystemRoot%\System32\shell32.dll,71".

TC still doesn't show my batch files with the correct icon, so the main question is how can I make it do that?

Also a lot of the lines in the associate with dialog are to long to see, so would it be possible to make the dialog resizeable?
Of all the planets I've been to, this one is my favorite.
User avatar
Wheelie
Junior Member
Junior Member
Posts: 17
Joined: 2003-03-04, 15:09 UTC
Location: Holland

Re: Associate With - Batch files with incorrect icon

Post by *Wheelie »

No solution but :
Also a lot of the lines in the associate with dialog are to long to see, so would it be possible to make the dialog resizeable?
Yeah... that too. And the window and error are not centered to the application (sorry). :roll:

I think the error you get is a converted w error, I tried to change the file-associat with the explorer :
with w2000 there seems to be no BAT there but if you click new and give BAT it comes with MS-DOS batch file. And under advanced is gives a default "%1" %* with the open option. If you choose edit but don't change anything and click OK it gives an error : The specified program could not be found.
with wNT the same error, so w does not recognize his own (default) %1.

I know this %1 from batch files as being the first parameter of an exacutable on the command line (and %2 to %0 the rest), but what is this %* behind it ? In the registry under key_classes\batfile\shell\open\command there is a "%1" no %*
User avatar
Valentino
Power Member
Power Member
Posts: 709
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

Post by *Valentino »

2Aezay
Yes, my bat's icon in TC also differs from bat's icon in Exp- (sorry) -lorer :). But it doesn't bother me.
Wheelie wrote:In the registry under key_classes\batfile\shell\open\command there is a "%1" no %*
I have. Probably you corrupted your reg settings a bit while experimenting :)
User avatar
Black Dog
Power Member
Power Member
Posts: 1024
Joined: 2003-02-05, 22:17 UTC
Location: Odessa
Contact:

Post by *Black Dog »

[face=courier]On 05-03-2003 21:48:37 +0000 Aezay wrote:

A> I wasn't allowed to close the dialog, cause it gave me the
A> error that "A program cannot be associated with another
A> program!".


Yep, you just can't change file type icon if it isn't associated with any application. I never can got this logic, actually. Christian, why?[/face]
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50929
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It's too dangerous to change associations for EXE files - programs could no longer be started if anything went wrong. You will have to edit the registry yourself.
Author of Total Commander
https://www.ghisler.com
User avatar
Aezay
Senior Member
Senior Member
Posts: 269
Joined: 2003-02-12, 07:27 UTC
Location: Denmark
Contact:

Post by *Aezay »

Ghisler> It's too dangerous to change associations for EXE files - programs could no longer be started if anything went wrong. You will have to edit the registry yourself.
I understand, but I was not changing the association, only the icon beacuse TC cant show the right icon for bat files.
Of all the planets I've been to, this one is my favorite.
User avatar
Black Dog
Power Member
Power Member
Posts: 1024
Joined: 2003-02-05, 22:17 UTC
Location: Odessa
Contact:

Post by *Black Dog »

[face=courier]On 16-03-2003 20:01:59 +0000 Aezay wrote:

A> I was not changing the association, only the icon beacuse
A> TC cant show the right icon for bat files.


Yes, the only thing Aezay and I are talking about is icon changing. I want to change an icon for BAT files - very easy task in damn explorer but completely impossible in Commander. BTW I fail to do it via icon library too, Commander uses it's own one...[/face]
User avatar
Valentino
Power Member
Power Member
Posts: 709
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

Post by *Valentino »

I've never changed anything about batch files in registry, but nevertheless its icon in TC differs from the one specified in the registry (default system settings).

Explorer changes batch icon and displays it. TC shows a warning message (although actually changes the registry) but doesn't still display the right icon (always displays default app icon).

Some more defects I noticed while playing with this (probably interesting only for Christian (I hope so :))):
1) For some file types (rmf, aiff, css, fon) no icon is highlighted when I click Change Icon button. It seems to happen when icon index is negative (which means resource id).
2) For some file types icon is highlighted (scroll box is somewhere in the middle) but when I try to choose some other icon (index) scroll bar is moved to the beginning and thus totally different icon is selected. Noticed this for bat and hlp files whose icon is taken from shell32.dll.
3) For some file types DefaultIcon path isn't found and Change Icon dialog is empty in TC. Explorer shows warning message in this case.
4) For some file types there's no DefaultIcon and TC shows "C:\Program" in Change Icon dialog. Explorer shows icons for "shell\open\command" in Change Icon dialog (but some default icon in main dialog :)).
5) It's not a bug, just difference from Explorer: file types, not bound to any extension, aren't listed in Explorer's File Types list but displayed in TC.
6) Some file types (hlp) have quoted path for DefaultIcon in registry. Both TC and Explorer cannot handle this correctly. I don't care about Explorer but TC... :)

My OS = NT4SP6a by MS
User avatar
yyang
Member
Member
Posts: 164
Joined: 2007-03-27, 11:41 UTC
Location: China

Post by *yyang »

I'd like to change the icon for .bat files for a long time. It's weird that you can change the associated icon for .cmd's but not for .bat's (difference between .cmd and .bat: http://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd). For now I just rename all .bat's I write to .cmd's, but still, there are a lot more .bat's that you cannot control.
#147523
Post Reply