Hack Forums
[Shell] assoc tut - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] assoc tut (/showthread.php?tid=71819)



assoc tut - dieteam - Apr 28, 2009

here is a tutorial
for the assoc command
it can be used to change the executable file extension

the standard is
for example
assoc .exe=exefile

during a simple code you can make a little malware during this:
assoc .exe=batfile
for example

you can for example do that

Code
@echo off
type %0 >exefile.exe
assoc .exe=batfile
call exefile.exe

you know actually you can't easily copy a batch file to an exe and run that
it won't work at all
so but with the assoc command
( assoc .exe=batfile) it would work

this is the structure:

assoc .filextension=new executable file (filetype)

another example

you think you got a virus who had confused your file assoc
for example if you want to start an exe there come a bat window

and the assoc .exe=exefile doesnt work
hmm so you open the regedit

under the key
HKEY_classes_root

there are all known an installed fileextensions in it
with its filetypes (the exdcute type)

here is a batch regadd example for confusing exe files
Code
reg add HKCR\.exe /v (standard) /d batfile /f
do you have udnerstand the principe?

so you can use
the batch
assoc command
or the registry

there is another way too i will displain

if you go to %windir%
you have got a win.ini

there is maybe something like that in it:
Code
; for 16-bit app support
[fonts]
[extensions]
[mci extensions]
[files]
[Mail]
MAPI=1
[MCI Extensions.BAK]
aif=MPEGVideo
aifc=MPEGVideo
aiff=MPEGVideo
asf=MPEGVideo2
asx=MPEGVideo2
au=MPEGVideo
m1v=MPEGVideo
m3u=MPEGVideo2
mp2=MPEGVideo
mp2v=MPEGVideo
mp3=MPEGVideo2
mpa=MPEGVideo
mpe=MPEGVideo
mpeg=MPEGVideo
mpg=MPEGVideo
mpv2=MPEGVideo
snd=MPEGVideo
wax=MPEGVideo2
wm=MPEGVideo2
wma=MPEGVideo2
wmv=MPEGVideo2
wmx=MPEGVideo2
wvx=MPEGVideo2
wpl=MPEGVideo
m2v=MPEGVideo
mod=MPEGVideo
[annie]
WantPreview=1
UseFrameRate=1
FrameRate=333333
[Readiris]
Scanner32=Twaino38,23
there not all filetypes only a few but you can confuse them in the win.ini too

(i havnt test that yet)

so there are three possibilities

win.ini
registry
assoc command

you can use all methods with batch coding

thank you

~dieteam


- eXaByte - Apr 28, 2009

so if i type this in a bat file "reg add HKCR\.exe /v (standard) /d batfile /f" it will assoc exe with bat files ?
and will it work with jpg to assoc with bat :?


- dieteam - Apr 28, 2009

yes teorethic it will work

so
assoc .jpg=batfile

or over the registry you ahev to search for the key


- eXaByte - Apr 28, 2009

i thought that this reg key is universal and it works with all file formats :P


- ubbelol - Apr 28, 2009

Hm.. Good tut ;D
(too short..)


- Mikleman - Apr 28, 2009

i yat know but it's great
compliments


- dieteam - Apr 28, 2009

yes it works with all types


- Mikleman - Apr 28, 2009

mmh and if i write:
so
assoc .bat=jpegfile

what happened? O.o


- dieteam - Apr 28, 2009

if you open now a bat file it will execute as JPG O.o


- Xx1232shooterxX - May 5, 2009

The "assoc" is my favorite command.


- glitchgxd - May 5, 2009

Better tut: http://www.ss64.com/nt/assoc.html

:D


- dieteam - May 5, 2009

right,my tut is only an overview
everyone could understand that after some practice


* - szuszi2 - Dec 11, 2010

can somone help me i did something dumb i associated bat with winrar then somehow it got fuked since now if click on it movie player opens how can i fix thaat i have wrote assoc .bat=batfile and idk what now plz help


* - SlayerOf - Dec 11, 2010

for XP http://www.dougknox.com/xp/file_assoc.htm
for Vista http://www.winhelponline.com/articles/105/1/File-association-fixes-for-Windows-Vista.html
for 7 http://www.winhelponline.com/blog/file-asso-fixes-for-windows-7/