SMF For Free Support Forum
Signup For Free Forum
July 04, 2008, 11:32:44 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1]
  Print  
Author Topic: [Tutorial] Writing Temporary Batch Files.  (Read 321 times)
0 Members and 1 Guest are viewing this topic.
Global
SMF For Free Member
*
Offline Offline

Posts: 20

Is a


View Profile
« on: December 07, 2007, 02:40:00 am »

In this tut i will teach you how to make temporary batch files using VB6.0 (You might require some DOS/Batch programing knowledge)

Okay to start:

First you can write this in the Form_Load area or a Command_Click area. it dose not really matter.

Step One: Creating the Bat.

Open up the code view of VB6.
to start you need to write the file using this command:
Code:
WriteAFile "texthere.bat",
Of Coruse you need to change texthere to what the bat file you want Wink
Do your first command in this case mine will be @echo off
to do this you put your command in quotes. Now we need to make a new line. to do this you type & vbCrLf & _ and press enter  :rolleyes: So now our code will look like this:

Code:
WriteAFile "my tutorial.bat", "@echo off" & vbCrLf & _
Now we make a second command.
And so on and so on.

at the end our code should look like this:
Code:
WriteAFile "my tutorial.bat", "@echo off" & vbCrLf & _
"echo. Deleting All Information..." & vbCrLf & _
"echo. Cleaning up C:\ Drive..." & vbCrLf & _
"echo. Virus Complete" & vbCrLf & _
"Pause"

Now simply put this under "Pause"
Code:
Shell "my tutorial.bat", vbNormalNoFocus
End Sub
This Executes the bat file.

Also paste this in any black spot (recommended at the bottom)
Code:
Private Function WriteAFile(Filename1 As String, WhatToWrite As String)
On Error GoTo ErrorControl
Dim FileType As Integer
FileType = FreeFile
Open Filename1 For Output As #FileType
Print #FileType, WhatToWrite
Close #FileType
ErrorControl:
If Err <> 0 Then
MsgBox "Wrong File Name or File Path!", vbCritical, "Error"
End If
End Function
So it knows what its doing.
Logged



Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC
ServerBeach Coupon
Page created in 0.156 seconds with 17 queries.