• Welcome to Valhalla Legends Archive.
 

Copy / Paste exe help.....

Started by OuTLawZGoSu, January 01, 2004, 07:55 PM

Previous topic - Next topic

OuTLawZGoSu

Aight, this is what i need.

- I need a program ( Program1 ) to copy it's self when you press Command1.
- Then paste that copy in a folder called "Folder2" in program1's folder.
- Then make a text file in Folder2 named "Log.txt", and print "Complete" in the text file.

If this can be done, plz let me know.

drivehappy

#1
Quote from: OuTLawZGoSu on January 01, 2004, 07:55 PM
Aight, this is what i need.

- I need a program ( Program1 ) to copy it's self when you press Command1.
- Then paste that copy in a folder called "Folder2" in program1's folder.
- Then make a text file in Folder2 named "Log.txt", and print "Complete" in the text file.

If this can be done, plz let me know.


Private Sub Command1_Click()
MkDir(AppPath, "Folder2")
Filecopy(AppPathAndFileName, AppPath & "\Folder2")
Open AppPath & "\Folder2\Log.txt" For Binary As #1
Put #1,,"Complete"
Close #1
End Sub


I believe most of it's correct, I didn't use the VB IDE's autocomplete to check parameters.

Spht

#2
Quote from: OuTLawZGoSu on January 01, 2004, 07:55 PM
Aight, this is what i need.

- I need a program ( Program1 ) to copy it's self when you press Command1.
- Then paste that copy in a folder called "Folder2" in program1's folder.
- Then make a text file in Folder2 named "Log.txt", and print "Complete" in the text file.

If this can be done, plz let me know.

It can be done, yes.

Did you want to know how? Use FileCopy to move the file (or MoveFile API). I believe you need to be on a NT system to rename/move(?) running executables. You can use the MkDir statement to create the folder if it doesn't already exist.  Use the Open statement to access a file and write to it.