![]() ![]() I figured the easiest way to get the path of the calling program is to just have it passed in as a parameter. TASKLIST | FIND /I "%filename%" >NUL 2>&1 Make sure you copy the batch file before you test it because it will delete itself! OFF This is particularly useful for an NSIS installer because the batch file can be embedded in the exe and then extracted. And obviously I want to see if it can be improved upon, of course. So what if there was a general-purpose batch file that deletes the calling executable and then deletes itself? I couldn't find such a batch file so I made one, thinking maybe it could be useful to others. ![]() However, a batch file can delete itself, presumably because its contents get copied so the file can close before the code gets run. An exe can't delete itself because an exe can't be deleted while it's running. There are times when I want to run a one-off executable on an end-user's machine that cleans up after itself, i.e. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |