self-destruction

Self Delete Folder with scripts powershell

非 Y 不嫁゛ 提交于 2021-02-08 06:38:13
问题 I have been trying to have powershell or batch scripts delete a folder that contains all my scripts when I am finished. Originally I tried Remove-Item -Path "C:\Tool" -Recurse -Force which worked no problem if run as a script for a location outside of C:\Tool . It would complain the files were in use when run from a script within. After some research I found &cmd.exe /c rd /s /q "C:\Tool" which worked much better, but even though I closed the GUI, the command wouldn't delete the img files

Self Delete Folder with scripts powershell

我的梦境 提交于 2021-02-08 06:36:44
问题 I have been trying to have powershell or batch scripts delete a folder that contains all my scripts when I am finished. Originally I tried Remove-Item -Path "C:\Tool" -Recurse -Force which worked no problem if run as a script for a location outside of C:\Tool . It would complain the files were in use when run from a script within. After some research I found &cmd.exe /c rd /s /q "C:\Tool" which worked much better, but even though I closed the GUI, the command wouldn't delete the img files

How could one design a secure and “self-destructing” email?

回眸只為那壹抹淺笑 提交于 2020-01-29 17:52:22
问题 As most of you know, email is very insecure. Even with a SSL-secured connection between the client and the server that sends an email, the message itself will be in plaintext while it hops around nodes across the Internet, leaving it vulnerable to eavesdropping. Another consideration is the sender might not want the message to be readable - even by the intended recipient - after some time or after it's been read once. There are a number of reasons for this; for example, the message might

How to make a object delete itself from a list. [closed]

*爱你&永不变心* 提交于 2019-12-20 07:56:06
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . So I have some objects in a list. I want to make my object to have a method that when called will delete itself from the list. How could I do that? 回答1: Is this a trick question? public class MyObject { public void RemoveFromList(List<MyObject> list) { if (list == null) return; list.Remove(this); }

Delphi: Is it ok for a form to free it self?

隐身守侯 提交于 2019-12-18 14:56:12
问题 I have a form that I use to show some information for some seconds. Is it ok for the form to free itself? Can I start a timer in the constructor, and then call self.free in the timer-event? Or will this potentially lead to trouble? 回答1: In addition, with a form you can call Release . It sends a CM_RELEASE message to the form. As a reaction it calls Free. The advantage of release is that there are no messages left for the form which could result in a crash. 回答2: You can make the form to free

Is it valid to directly call a (virtual) destructor?

徘徊边缘 提交于 2019-12-18 07:55:45
问题 In this answer, Ryan directly calls the virtual destructor. I've tested the code in VS2010, and it correctly calls all destructors (tested with logging statements). Is it actually valid to do so? What are the problems, flaws or even the good points of such an approach? I can only think of it as a way to really force a reset of the actual type, even if they don't override a virtual reset function, since they atleast have to clean up in their destructors. Also, eactly what kind of side-effects

Is it valid to directly call a (virtual) destructor?

余生长醉 提交于 2019-12-18 07:53:21
问题 In this answer, Ryan directly calls the virtual destructor. I've tested the code in VS2010, and it correctly calls all destructors (tested with logging statements). Is it actually valid to do so? What are the problems, flaws or even the good points of such an approach? I can only think of it as a way to really force a reset of the actual type, even if they don't override a virtual reset function, since they atleast have to clean up in their destructors. Also, eactly what kind of side-effects

Is it OK to use “delete this” to delete the current object?

随声附和 提交于 2019-12-17 16:49:31
问题 I'm writing a linked list and I want a struct's destructor (a Node struct) to simply delete itself, and not have any side effects. I want my list's destructor to iteratively call the Node destructor on itself (storing the next node temporarily), like this: //my list class has first and last pointers //and my nodes each have a pointer to the previous and next //node DoublyLinkedList::~DoublyLinkedList { Node *temp = first(); while (temp->next() != NULL) { delete temp; temp = temp->next(); } }

Self deletable application in C# in one executable

自闭症网瘾萝莉.ら 提交于 2019-12-17 08:21:35
问题 Is it possible to make an application in C# that will be able to delete itself in some condition. I need to write an updater for my application but I don't want the executable to be left after the update process. There is an official .Net OneClick but due to some incompatibilities with my HTTP server and some problems of OneClick itself I'm forced to make one myself. George. [EDIT] In more details: I have: Application Executable which downloads the updater ("patch", but not exactly) this

Self deleting bash script

落爺英雄遲暮 提交于 2019-12-10 01:11:54
问题 How can a bash script execute even after encountering a statement to delete itself? For eg when I ran test.sh script which conains: <--some commands--> rm test.sh <--some more commands--> end The script executes till the end before deleting itself 回答1: What actually happens is that bash keeps the file open and rm won't make that stop. So rm calls the libc function "unlink()" which will remove the "link" to the inode from the directory it's in. This "link" is in fact a filename together with