command line delete on reboot

By Spike ยท 4 replies
Jun 5, 2006
  1. I need to schedule the removal of a file on reboot for a batch script I'm writing, but each time I think of a term to google, it comes up with a million and one results on everything but.

    DOes anybody here know how to do this from the command line (ie, WITHOUT the use of win32 GUI programs such as HJT.

    Ideally (though perhaps not essential) the file should be deleted at the point where programs such as CHKDSK would normally run. The one thing I partularly DON'T want to do is use the registry to do it.
  2. Nodsu

    Nodsu TS Rookie Posts: 5,837   +6

  3. Spike

    Spike TS Evangelist Topic Starter Posts: 2,168

    That's a fairly interesting list. I don't like it much, but if it's the only way, it's the only way - It won't hurt just this once I guess, though I would have thought that deleting a file that's in use is a fairly common thing to need to do.

    What's happening is that a when a file locks up and can't be deleted, Obviously I want to delete it, but even if I rename the file it's still locked "in use".

    The 2k resource kit had a solution for it (inuse.exe), but I can't find it now and don't know if it works on XP.

    Still, If I have to do like the bad guys do, then so be it - untidy, but effective.
  4. altheman

    altheman TS Rookie Posts: 425

    What about "autoexec.bat"?? You could write a batch script in that, although its never worked for me.
  5. Spike

    Spike TS Evangelist Topic Starter Posts: 2,168

    I could call a batch script from autoexec.bat just the same as win.ini or from the registry.

    The trouble is, it's untidy, doesn't remove itself (and so requires further scripting (if minor) to remove it afterwards, and is generally a bit of a pain really.

    What would be really useful would be to call the appropriate windows API from the script...


    ...but of course, nothing could be so easy. (that was sarcasm. lol)

    In the end, after some googling, I found an appropriate CLI utility through google (dellater), and better still, it comes with its assembly source code (all hail Open Source and the public domain! :) Not that I can actually write assembly from scratch, but sometimes small, well commented scripts such as this are easy to manipulate, as a very limited understanding of program flow and syntax in genereal can go a long way). So, with a few very simple modifications to that source and the appropriate assembler, I was able to modify and compile the tool to act as I wanted, and so now I don't have a problem :)

    Problem solved :)

    All I have to do now is put it to a nasty use and I could call myself a script kiddy! lol I'm NOT going to do that though. It's a name I'd rather not earn.
Topic Status:
Not open for further replies.

Similar Topics

Add your comment to this article

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...