create an executable with a file....

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kgprov
Posts: 2
Joined: 17 May 2011 15:03

create an executable with a file....

#1 Post by kgprov » 27 Oct 2011 09:12

Hi I created a batch to give to a user that will basically go in and replace a file with the one I am providing. The file name will always remain the same, only that the one I provide will have necessary information. I want to convert this batch to an executable and include the file that the batch calls to change. The problem I am having is what changes do I need to do to the batch file so that it grabs the attached file I want to give. I dont want to send the users a batch and then tell them to for example specifically put a folder on their desktop. I just want to send it so they only have to double click on the icon and done. Here is my code:

@echo off



REM Used to create a backup of the original host file and copy in the new one

icacls C:\Windows\System32\drivers\etc\hosts /grant User:(F)

REM Creating a backup of the original host file
ren C:\Windows\System32\drivers\etc\hosts hostsbk

REM Here I want to copy the file over to the specified location.
xcopy "%USERPROFILE%\Desktop\Test\hosts" C:\Windows\System32\drivers\etc\ /y



icacls C:\Windows\System32\drivers\etc\hosts /grant User:(R)

Pause


I am using bat_to_exe converter
Thanks in advance.

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: create an executable with a file....

#2 Post by abc0502 » 29 Oct 2011 00:13

what i understood from your post is that there is a batch file and a file. you use the batch file to copy the file to the specific directory if that write
why don't u use the sfx option in rar or 7zip to make an exe file that have both files, the sfx file will extract the files to temprary directory "%temp%" and then run the batch file. all that will happen when you click the sfx file
i tried to change a batch file before and after converting it the antivirus gived alarm of delphi virus

Post Reply