How are you?
I'm trying to do a self-update function.
I already did my copy with other name.
I'm trying to use a bath file when i close my app to delete this one.
std::string filename = "bat.bat";
GetModuleFileName(0, myApp, MAX_PATH);
std::string finalDir = std::string(dir) + "\\bat.bat";
bat += ":Repeat ";
bat += "del " + std::string(myApp);
bat += " if exist " + std::string(myApp) + " goto Repeat ";
bat += " del " + finalDir;
std::ofstream file(filename, std::ios::out);
file << bat;
ShellExecute(NULL, "open", finalDir.c_str(), NULL, NULL, SW_HIDE);
I'm not understand i need to do. I'm not good with bath files.
I'm executing it here:
I want to delete the actual program and self-delete the bath after.
Ty for you attention and help.