i'm trying create vb.net application writes multiple lines of text text file, starts application , after application started, deletes text file.
how can realize that?
--
edit:
i got code:
dim inifile string = application.startuppath + "\settings.ini" if system.io.file.exists(inifile) = true file.delete(inifile) end if if system.io.file.exists(inifile) = false file.create(inifile) end if dim filestr string() = {"line1", "line2", "line3"} file.writealllines(inifile, filestr) dim p process = process.start(application.startuppath + "\app.exe") p.waitforinputidle() if system.io.file.exists(inifile) = true file.delete(inifile) end if
the problem got, vs telling me, file in use. between creating , editing file. ideas that?
your code starting app , moving straight on delete ini file.
you need wait process exit first before continue deleting ini file
e.g
{code create ini file} 'start process. dim p process = process.start(application.startuppath + "\app.exe") 'wait process window complete loading. p.waitforinputidle() 'wait process exit. p.waitforexit() {code delete ini file}
full example here: https://support.microsoft.com/en-us/kb/305368
Comments
Post a Comment