Ok how do i get my program to delete its self? Because when i do Kill or My.Computer.FileSystem.DeleteFile the Access is denied because its still running. So how do i get it to delete its self
Printable View
Ok how do i get my program to delete its self? Because when i do Kill or My.Computer.FileSystem.DeleteFile the Access is denied because its still running. So how do i get it to delete its self
i could think of a way, but it just seems odd that previously you wanted to disconnect a remote computer, and now you want a program to delete itself... i dunno.. im still seeing red flags.
what are you trying to accomplish as an end goal here?
In the spirit of you breaking something so we all get paid to fix it... Write out a .bat file which deletes the executable path directory and set that batch file to run on system boot, then shutdown the computer
Same thing..and fun :D
It does seem odd, but just as an academic exercise I would suggest the use of a batch file triggered in the application_exit event which would wait for approximately 5 seconds before deleting the program file.
actually i have done this before in vb6 - same will apply for .net tho ... create the bat file that looks kinda like the following from with in your project:
Then run the bat from your interface:Code::StartOver
del myApp.exe
IF EXIST myApp.exe GOTO StartOver
del thisbat.bat
then close your app :)Code:Shell("delme.bat", AppWinStyle.Hide)
You should use this code in .NET
vb.net Code:
Process.Start("delete_me")
Is there a specific reason for wanting to do this?
I can only think of one: A destructive application that deletes files, folders, or worse, then removes itself to hide its tracks.
An uninstaller.
It doesn't make much sense why an uninstaller would delete itself after it does it job. I'm seeing red flags...
@Seraph: Ahahahaha, yeah, lol. Now that I think it true, DUH! Lol. Anyhow, what I was trying to imply is that it sounds kind of weird.
tassa: errr...Uninstallers always delete themselves. lol
Well, in theory this program wants to log someone off a computer remotely.
Emcrank already said he owns the connection.
He will need credentials of the target PC to be able to do this.
And, how malicious can it be when after it deletes itself, you can get right back on.
The whole things sounds fishy to me too, but not sure what all that will accomplish.
really? I've never had an installer delete itself... the app sure... but the install file is always still there.... good thing too... sometimes I uninstall an app so I can reinstall it... the msi file doesn't disappear when I finish.
-tg
If you have a program that doesn't have the installer and uninstaller in the same executable it does. Like with INNO installer, the installer installs the program, and during installation it creates an uninstaller with specific instructions for deleting anything you flagged in INNO to uninstall (e.g. Registry keys that were created during the istallation, etc. And, in the end, the uninstaller is deleted as well since it is just that, an uninstaller; nothing else.
seems like he would've said "I am trying to uninstall my program and I would like the uninstaller to be deleted as well. How can I accomplish this?"
getting a program to close itself and delete sounds a bit different to me
Except that he called it an uninstaller after the fact. lol.
I know, it still seems shady, but we don't know much about it.
so we should wait for him to provide some detailed information before throwing all these ideas at him.
Then let's ask more straightforward. lol
Emcrank, what exactly is your program supposed to accomplish?
It seems no one here is willing to help because what you have described, thus far, seems a tad bit shady. (And I don't blame anyone for that; I'm thinking it's fishy too.)
And your reluctance to be forthcoming with the purpose of your program isn't helping either. Normally, when people have asked questions and sounded shady, they were willing to speak up and explain their true intent when confronted.
It seems you might get a better reception and more help in this issue if you were to just make everyone happy and let us know what exactly this whole program is supposed to do.
I Completly scrapped the thing about the disconnecting the internet it was to hard for me.
Anyway all i want is an uninstaller to uninstall my program and then uninstall its self so there is nothing left about it. Okay?
INNO Setup.
You can create an installer for your program, and it automatically creates an uninstaller for it.
Ok thanks
Various Downloads Very Handy For Renegade Users
This is from his web site. You all do what you want. I'm done here.
:(
What do you mean oops lol whats wrong with it?
He was thinking you meant hacking and stateofidleness was making it clear renegade referred to Command and Conquer. lol
Oh.. Lol i shud have changed it to C&C Renegade :D