Jump to content

Embedded files


Recommended Posts

I understand you can embedded a image file in the exe . Can you embedded any other files ? Like a bat file etc ?

And how do you do it ? I need to see how it is done with a little code if you please .

Thank you .

Link to comment
Share on other sites

Embed a .bat file sounds quite stupid to me.

The only reason for wanting something like this is that you need modify it easily anytime before compiling that I guess it is not the case.

I think is stupid because is much better IMNSHO just create it with a FileWrite() func.

E.g.

;I made a new line every new line of the .bat for readability... It is not needed
FileWrite("test3232.bat",_
":: this is my bat file" & @crlf & _
"Cls" & @crlf & _
"dir" & @crlf & _
"::ect")

RunWait("test3232.bat","",@SW_HIDE)
FileDelete("test3232.bat")
Edited by ezzetabi
Link to comment
Share on other sites

Ok lets say u have a autoit exe called A.exe and u have another autoit exe file B.exe embedded into it so as it appears to be one exe.

When A is run how would u extract B.exe to say the c:/

Edited by nova
Link to comment
Share on other sites

#include to embed a file

and

file install to extract it

No. #include is only used to include an AutoIt source. FileInstall is the only way to include a file. The fine will be embeded in the script when it is compiled, and extracted to the destination path when the line is executed in the code.

[Edit] Why can't you read the manual at work? they don't let you download any files at work? You can just download the chm helpfile and double click on it...

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

I actually dislike the use of #include I prefere copy the functions' code I need to the botton of the script, but as pekster said it is not the same of file install.

FileInstall() is needed to embed a file compiling time, when the script arrive to the FileInstall() line it extract the file to the destination for any use.

Usually it is used to messing with command line programs in hidden windows. Since you can never know if the computers the script will work have or not the program you need you just FileInstall it,use it and delete it.

The deletion is of course not automatic, so it is a good idea be careful and delete anything.

If the fileinstall happen at the begin of the script because the installed program is needed often I usually make a special _Terminate func that deletes all installed files before Exit and I use it anytime I should need a Exit.

E.g.

I copyed psexec.exe just before compiling in c:\Fileinstall\psexec.exe

FileInstall("c:\FIleInstall\psexec.exe",@tempdir & "\",1);Fileinstall want the trailing \

RunWait(@tempdir & "\psexec \\* cmd /c chkdsk c: /f","",@SW_HIDE)

_Terminate()

Func _Terminate()
   FileDelete(@temp & "\psexec.exe"
   Exit
EndFunc

BTW I know I need to relax... but I am quitting my job for a new life and I am quite worried...

Edited by ezzetabi
Link to comment
Share on other sites

BTW I know I need to relax... but I am quitting my job for a new life and I am quite worried...

Never mind man just seemed a little harsh but I know how its annoying when ppl ask simple questions and it seems there just too lazy to look up the help file !

I just didnt want to have to wait till I got home before checking it !

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
 Share

  • Recently Browsing   0 members

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