Hello, Im making a function that will cause my program to create a temporary bat file that will terminate and delete the main program and then delete itself:
If I run the .exe, it will start with creating the bat and then start the bat file in another window, but after the bat file is done I first get the "deleting..." echo, and then I get this message (translated from swedish to english):
myfiledel << "@echo off"<<endl;
myfiledel <<"taskkill /im program.exe /f"<<endl;
myfiledel <<"echo Deleting..."<<endl;
myfiledel <<"del program.exe"<<endl;
myfiledel <<"del tempdel.bat"<<endl;
Can not find the command file.
Both the bat and exe are deleted, but that message shows up in a cmd window.
If I instead manually create and execute the bat file without using the command in the exe, everything is deleted without this message showing up.
So I think it is becouse the system() launches the bat from inside a cmd window (might be wrong), And therefore I think I would need a replacement for system ().
Could anyone give me some advice here?
PS: Im not that good at english and I suck at describe things, but I hope you understand what Im trying to do.