exe file replace using QProcess
-
Hi
in linux the exe is not locked but I believe it is in windows.
Have you tried deleting it manually with explorer?@mrjj
my linux code isQProcess* process = new QProcess(this); process->start("rm", QStringList() << "mysoft"); connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished()));
tried the same path with
del
in cmd and it works fine -
@mrjj
my linux code isQProcess* process = new QProcess(this); process->start("rm", QStringList() << "mysoft"); connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished()));
tried the same path with
del
in cmd and it works fine -
@4j1th said:
Ok. never tried to delete running exe :)
I wonder about the name
"mySoft.exe.tmp"Why .tmp?
@mrjj download a new version from server and save it in mysoft.exe.tmp then remove mysoft.exe then rename mysoft.exe.tmp to mysoft.exe. I tried this method because in this way I don't want to create another program for updating.
I just try to delete another file in the same dir but the same error, then try to delete an image file in home dir it also give the same error. I think 't's not about the permission. also tried using
DEL /F /Q /A <File Path>
-
@mrjj download a new version from server and save it in mysoft.exe.tmp then remove mysoft.exe then rename mysoft.exe.tmp to mysoft.exe. I tried this method because in this way I don't want to create another program for updating.
I just try to delete another file in the same dir but the same error, then try to delete an image file in home dir it also give the same error. I think 't's not about the permission. also tried using
DEL /F /Q /A <File Path>
-
@4j1th
Hmm. i think might need to run cmd also as del is part of command.exe.
http://stackoverflow.com/questions/21596104/how-to-execute-a-cmd-command-using-qprocess
he uses "cmd"
something like
process->start("cmd", QStringList() << "del " << currentpath);
maybe ? -
@4j1th
Hmm. i think might need to run cmd also as del is part of command.exe.
http://stackoverflow.com/questions/21596104/how-to-execute-a-cmd-command-using-qprocess
he uses "cmd"
something like
process->start("cmd", QStringList() << "del " << currentpath);
maybe ?@4j1th said:
I am trying to update my soft. itself in windows, I can't replace a running exe itself with in so I try to do it by using QProcess.
You can't, the OS will lock the file and will not allow you to modify it. It doesn't matter if you use
QProcess
orcmd
, orexplorer
, it will not work. -
@4j1th
Hmm. i think might need to run cmd also as del is part of command.exe.
http://stackoverflow.com/questions/21596104/how-to-execute-a-cmd-command-using-qprocess
he uses "cmd"
something like
process->start("cmd", QStringList() << "del " << currentpath);
maybe ? -
@4j1th said:
I am trying to update my soft. itself in windows, I can't replace a running exe itself with in so I try to do it by using QProcess.
You can't, the OS will lock the file and will not allow you to modify it. It doesn't matter if you use
QProcess
orcmd
, orexplorer
, it will not work.@kshegunov so you're suggesting me to write another programme to run update
But this idea works on linux.
-
@kshegunov so you're suggesting me to write another programme to run update
But this idea works on linux.
-
@4j1th
Hi
just tested in win 7.
it wont allow to delete running exe.Linux will, i know. but Windows wont allow.
-
@4j1th
hiQProcess process; process.start("cmd", QStringList() <<"/C" << "del" << "e:/test.txt " );
this delete the file i put on e:\
-
you're right, can't replace running exe, so I think the best way to update is write an another app for updation right?
-
@4j1th
Well even another program cannot override the exe, so the updater must
close the running version. -
@4j1th
Ok. that makes it easier to get it to close. :)
Will user check for update from inside the program or how will that happen?
(if i may ask) -
@4j1th
Ok. that makes it easier to get it to close. :)
Will user check for update from inside the program or how will that happen?
(if i may ask)