Click to See Complete Forum and Search --> : Creating an EXE file
dontknow
03-03-2003, 07:06 AM
Hello,
I would like you to help me out in creating an EXE file. Actually, I have 2 BATCH files (.bat) which will add certain IP entries to the local HOST file. These 2 files, I want them to be comprised into an EXE File.
This process, I tried using VB with EXEC command. But, as am not aware of the syntax and the process in VB, I am now stuck up with it. :( It would be great help for me if you could share your knowledge and help me out in this process of creating an EXE files. The same EXE file will then be implemented on all Users desktop, maybe using Group Policy or any either way provided in Windows 2000 or Exchange 2000.
Thanks in Advance,
Regards,
Krish :)
AllGamer
03-03-2003, 11:25 AM
there's a lot more involved in here
is best if your first take a Course in Programming
:t
Hmm...do you know what an .exe file is?
a file with an .exe, is the result of a compilated sourcefile
written in any programlanguage, The sourcefile is then
"translated" so the hardware can understand what
its all about (generates a If you dont know how to write code,
and use a compilator, I agree with Allgamer.
Get some knowledge about programming first.
Dark_Raver
03-04-2003, 01:32 PM
If you have batch files that do what you want to achieve than i don't see why you want to go with exe.
you should be able to do just about the same with the batch files as you would with the exe.
AltatemTC
03-04-2003, 03:12 PM
If you are serious about making this an EXE try WinBatch compiler. I assume you are compiling to an EXE so the "users" can't screw it up.
dontknow
03-04-2003, 10:51 PM
Hi,
I think you are mistaken and have got an varied opinion abt my knowledge in programming. Well, to be precise, am good in Macro Virus Programming (Just a personal interest and NOT to spread on the net and irate users). Did you hear that? Its just that am stuck up in a syntax using EXEC command in Visual Basic to trigger a batch file in FORM LOAD event. (And FYI, Yes! This is for a different project and not for Virus Coding)
So, GOBI & ALLGAMER, I hope you are now convinced with my knowledge on programming and EXE file creation. :)
DARK RAVER, reason for creating an EXE file instead of using the same BAT file is that, users will not be able to view the content of an EXE file whereas in a BAT file they shall view and if permission are not set, they can even EDIT the same. So, I prefer to make it an EXE file. Hope you are now convinced. :)
ALTATEM TC, I honestly thank you for responding me with an info which could help me out. I will surely try that too. :)
I now have managed to achieve my task using the following coding stuff. Please check it out.
CODE 1:
----------
Shell Environ("ComSpec") & " /k " & "D:\Krish\HostIP.bat",vbnormalfocus
This will execute the batch file available in D:\Krish folder.
Environ("ComSpec") will resolve to the path of either "cmd.exe" or "command.exe", depending on the operating system.
"/k" tells it to keep the DOS window open after the operation completes. You could use "/c" if you want to close the window upon completion.
vbNormalFocus tell it to show the DOS window with focus.
CODE 2 (not much difference to that of CODE 1):
-------------------------------------------------------------
RetVal = Shell("D:\Krish\HostIP.bat", 1)
RetVal = returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.
This code will be included in the FORM LOAD event and FORM's VISIBLE property will be set to NO (hidden). Finally, once the task is accomplished, this VB project will be converted to an EXE file by using the built in "BUILD EXE" feature in Visual Basic. Hope that you are now convinced again.
Well, That's it for now. Anywayz, I shud thank you all for your response. Have a nice time.
And, Yes! Do help me out if you feel that there is still any simpler way to achieve my task using VB. :)
Cheers!
Krish
bassman
03-18-2003, 09:36 AM
I think we're all convinced...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxlrfexecmethod.asp
Dark_Raver
03-21-2003, 02:49 PM
Just to let you know that what you doing will work but will not fix the problem.
RetVal = Shell("D:\Krish\HostIP.bat", 1)
will run the bat file, and the user will not be able to do anything with the exe vb will make for you, BUT....
there is still the bat file D:\Krish\HostIP.bat that the user will be able to edit.
if you wanted a fool proof method of acomplishing that and keeping the internals out of users reach than i believe the easiest way would be to read in the file, add your entries to it and then write it out.
Dark_Raver
03-21-2003, 02:56 PM
' this part opens file so you can read it
Dim FileNumber As Integer
Dim TextLine As String
FileNumber = FreeFile
Open "filename" For Input As FileNumber
' this part reads the file
Do Until EOF(FileNumber)
Line Input #FileNumber, TextLine
' do whatever with the text
loop
'remember to close file afterwards
Close #FileNumber
now i don't have an example handy of writing to the file but i beleve it would be similar except open it for output and do
Line Output #FileNumber, TextLine
to write to it.
frnkzks
04-16-2003, 03:42 PM
Post the 2 batch files, and I will give you an EXE file.
SysOpt.com
Copyright Internet.com Inc. All Rights Reserved.