Hi, I have been able to deploy a vb.net project onto some systems, which basically downloads latest files and then the main project handles all the updates from that point forward. So what I would like to be able to do is to delete the exe I install after it has done the download. How can i do this? I know this must be very easy code, but I very new to vb.net,....pls help...
Comments
Here's what you do to write a batch file.
Keep in mind I haven't had to do this in .net yet, but I'm sure it works just as well here as it did in 6.0
Write a file that looks like the following one from within your code. Replace C:Appname with your exe path, replace C:Batname with the path of the batch file you are going to create, and save it with a ".bat" extention
[code]
Del C:Appname
Del C:Batname
[/code]
The batch file will delete itself just fine. This will all happen so fast, that by the time windows updates, you will never even know there was a batch file there. It will look just like your application just disapeared.
One problem I run into with creating batch files, is that I wanted to ping something once, and so I made my program write a batch file that said "Ping 127.0.0.1 >> C:SomePathSomeFile.txt". This is supposed to send the results to a file that I could pick up, but unfortunately, my theory that windows holds off on certain commands until your program exits, it wouldn't write the file until my program exited. So I couldn't pick it up. The way I got around this was to write to batch files, and one of them ran the other. The one I would call that ran the other could do this immediately, then when that batch file exited, the file from the second was written to disk and I could pick it up in a matter of about 2 or 3 miliseconds. (I set the timeout to be very short on the ping).
I am sure there was a better way to ping, but I needed a solution right away and wasn't aware of any simple API calls, or internal VB6.0 functions that could do this for me.
ANyways, I hope some of this helped you at all.
><//~Psightoplasm`~
:
: Here's what you do to write a batch file.
:
: Keep in mind I haven't had to do this in .net yet, but I'm sure it works just as well here as it did in 6.0
:
:
: Write a file that looks like the following one from within your code. Replace C:Appname with your exe path, replace C:Batname with the path of the batch file you are going to create, and save it with a ".bat" extention
:
: [code]
:
: Del C:Appname
: Del C:Batname
:
: [/code]
:
: The batch file will delete itself just fine. This will all happen so fast, that by the time windows updates, you will never even know there was a batch file there. It will look just like your application just disapeared.
:
: One problem I run into with creating batch files, is that I wanted to ping something once, and so I made my program write a batch file that said "Ping 127.0.0.1 >> C:SomePathSomeFile.txt". This is supposed to send the results to a file that I could pick up, but unfortunately, my theory that windows holds off on certain commands until your program exits, it wouldn't write the file until my program exited. So I couldn't pick it up. The way I got around this was to write to batch files, and one of them ran the other. The one I would call that ran the other could do this immediately, then when that batch file exited, the file from the second was written to disk and I could pick it up in a matter of about 2 or 3 miliseconds. (I set the timeout to be very short on the ping).
:
: I am sure there was a better way to ping, but I needed a solution right away and wasn't aware of any simple API calls, or internal VB6.0 functions that could do this for me.
:
: ANyways, I hope some of this helped you at all.
:
:
:
:
: ><//~Psightoplasm`~
:
:
I'm not sure, but will this work?:
[code]
dim filename As String
filename = Application.Filename (Can't remember code for App's Filename)
Kill(filename)
[/code]
:
: I'm not sure, but will this work?:
: [code]
: dim filename As String
: filename = Application.Filename (Can't remember code for App's Filename)
: Kill(filename)
: [/code]
:
No... an application can't delete itself because it is still running.
><//~Psightoplasm`~
:
: :
: : I'm not sure, but will this work?:
: : [code]
: : dim filename As String
: : filename = Application.Filename (Can't remember code for App's Filename)
: : Kill(filename)
: : [/code]
: :
: No... an application can't delete itself because it is still running.
:
: ><//~Psightoplasm`~
:
: