homepage Welcome to WebmasterWorld Guest from 54.196.62.132
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Microsoft / Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10)
Forum Library, Charter, Moderators: bill

Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10) Forum

    
Associate Files With Icon
TheKiller




msg:4199811
 3:52 am on Sep 10, 2010 (gmt 0)

Hi

Dos Anyone how to Associate a Unknown File Type With an Ico And a Program by using a VBScript ?

i know how to do it manually from The folder Options but i would like to know if its possible to do it in a VBS

Thanks

 

kaled




msg:4199900
 9:10 am on Sep 10, 2010 (gmt 0)

I don't use Visual Basic, etc. so there may be a function built in, however if not (and assuming you want your code to work pre-vista) then I believe you must make changes directly to the registry.

I found the following code snippet...

REGEDIT4

[HKEY_CLASSES_ROOT\.jar]
@="jarfile"

[HKEY_CLASSES_ROOT\jarfile]
@="Executable Jar File"

[HKEY_CLASSES_ROOT\jarfile\shell]

[HKEY_CLASSES_ROOT\jarfile\shell\open]

[HKEY_CLASSES_ROOT\jarfile\shell\open\command]
@="C:\\Program Files\\JavaSoft\\JRE\\1.3.1\\bin\\javaw.exe -jar %1"


If you place this is a .reg file and execute it, necessary registry changes should be made.

Personally, I would use API functions such as RegOpenKeyEx but this may be more complicated.

Kaled.

TheKiller




msg:4200155
 6:02 pm on Sep 10, 2010 (gmt 0)

Hi Kaled

I Am using Win Xp Pro And i only need it to work on that

i Tried to associate a .tga file with this


REGEDIT4

[HKEY_CLASSES_ROOT\.tga]
@="TGAFile"

[HKEY_CLASSES_ROOT\TGAFile]
@="Executable Jar File"

[HKEY_CLASSES_ROOT\TGAFile\shell]

[HKEY_CLASSES_ROOT\TGAFile\shell\open]

[HKEY_CLASSES_ROOT\TGAFile\shell\open\command]
@="C:\\Documents and Settings\\TheKiller\\Desktop\\test.ico -tga %1"

but it did nothing...


Would you please Make some notes on Where to add the file Extension and the Icon etc

Thanks

kaled




msg:4200298
 10:00 pm on Sep 10, 2010 (gmt 0)

Ok, I've looked more closely,

For a .txt file, four lines appear to be needed for minimum functionality.

REGEDIT4

[HKEY_CLASSES_ROOT\.txt]
@="txtfile"

[HKEY_CLASSES_ROOT\txtfile\DefaultIcon]
@="%SystemRoot%\system32\shell32.dll,-152"

[HKEY_CLASSES_ROOT\txtfile\shell\open\command]
@="%SystemRoot%\system32\NOTEPAD.EXE %1"

Normally the icon will be a .exe file, and the index that follows it will be zero or a positive value.
You might want to use %ProgramFiles% to specify the icon and .exe file.

Since I don't use .reg files myself, I can't guarantee this is correct.

Kaled.

TheKiller




msg:4200326
 11:25 pm on Sep 10, 2010 (gmt 0)

hm.......

In the Windows Folder Options You are able of Selecting the Icon of the X FileType The message it will say when you Right Click it for Example "Run X File","Open X File"
and the program you want to open the file With

i need this mostly For .PHP Files to associate it faster Without going into the Folder Options

kaled




msg:4200613
 8:00 pm on Sep 11, 2010 (gmt 0)

I'm not sure I understand you, but if you want to add additional verbs (i.e. menu options) simply add extra lines such as...

[HKEY_CLASSES_ROOT\txtfile\shell\print\command]
@="%SystemRoot%\system32\NOTEPAD.EXE /p %1"

You can also add an alias

[HKEY_CLASSES_ROOT\txtfile\shell\print]
@="Print this file"

Kaled.

TheKiller




msg:4210708
 12:38 pm on Oct 3, 2010 (gmt 0)

Umm.....

i would like a file that has the fallowing Options that you may find in the :
Tools/FileOptions/FileTypes

like :


1. a .ico image that will represend the File
2. Program to open the file
3. a Action/option you see when you right click the file like Open PHP File

kaled




msg:4210847
 12:05 am on Oct 4, 2010 (gmt 0)

I believe I covered these points above.

TheKiller




msg:4213244
 4:48 pm on Oct 7, 2010 (gmt 0)

yes
but i would like you to but them (each lines)in the order you consider right as i know nothing about reg files

could you please set it for a .PHP Extension ?

Thanks in Advance

TheKiller




msg:4215131
 1:23 pm on Oct 11, 2010 (gmt 0)

i have tried this to register a .HTML File
it wont work........

REGEDIT4

[HKEY_CLASSES_ROOT\.html]
@="HTMLFile"

[HKEY_CLASSES_ROOT\HTMLFile]
@="Executable HTML File"

[HKEY_CLASSES_ROOT\HTMLFile\shell]

[HKEY_CLASSES_ROOT\HTMLFile\shell\open]

[HKEY_CLASSES_ROOT\HTMLFile\shell\open\command]
@="C:\\Program Files\\Notepad++\\notepad++.exe -html %1"

[HKEY_CLASSES_ROOT\HTMLFile\shell\print\command]
@="C:\Extension Ico\HTML.ico /p %1"

[HKEY_CLASSES_ROOT\HTMLFile\shell\print]
@="Open With Notepad++"

kaled




msg:4215171
 3:37 pm on Oct 11, 2010 (gmt 0)

Try the following, however, if .htm and .html are already assigned in the registry, making arbitrary changes may break existing functionality. To avoid this, I would suggest working with the registry directly - see [alanphipps.com...] this should allow to to make additions to existing settings rather than break existing settings.

Also, I don't use notepad++ so the /p switch may not work and I am not certain that .ICO files can be used to specify an icon in this way.

Kaled.


REGEDIT4

[HKEY_CLASSES_ROOT\.htm]
@="HTMLFile"

[HKEY_CLASSES_ROOT\.html]
@="HTMLFile"

[HKEY_CLASSES_ROOT\HTMLFile]
@="HTML File"

[HKEY_CLASSES_ROOT\HTMLfile\DefaultIcon]
@="C:\Extension Ico\HTML.ico"

[HKEY_CLASSES_ROOT\HTMLfile\shell\edit]
@="Edit with Notepad++"

[HKEY_CLASSES_ROOT\HTMLFile\shell\edit\command]
@="C:\Program Files\Notepad++\notepad++.exe %1"

[HKEY_CLASSES_ROOT\HTMLFile\shell\print_nppp]
@="Print using Notepad++"

[HKEY_CLASSES_ROOT\HTMLFile\shell\print_nppp\command]
@="C:\Program Files\Notepad++\notepad++.exe /p %1"

TheKiller




msg:4215248
 6:00 pm on Oct 11, 2010 (gmt 0)

Hello Kaled

i runned the script and restarted PC
it didnt really did much.........
it opens the file in the normal notepad and the icon works

the other settings like Edit with Notepad plus etc dont work

kaled




msg:4215273
 6:27 pm on Oct 11, 2010 (gmt 0)

There's no need to restart the computer after making these changes. As for it not working, I suggest you use RegEdit to verify the changes were made correctly and then check filenames and paths.

Kaled.

TheKiller




msg:4258778
 7:43 am on Jan 27, 2011 (gmt 0)

Hello after a long time .. lol

yesterday i have became a bit more familiar with the registry coding
i saw that you can export files etc from the registry editor and i think i've got it :D

i will try to make some page with a few forms to generate the files
but i got to look into the header thing to force downloads :-?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10)
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved