self deleting files, setting a delay time

By abtahei ·
how can i set the time at below code to activate the self deleting batch file after some minute, hours or days;
@echo off
Type "file"
PING -n 1 -w "time" >NUL
DEL "file"
DEL %0


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by seanferd In reply to self deleting files, sett ...

-w is just to set the timeout on the ping, in milliseconds. It has absolutely nothing to do with having a batch file WAIT until executing a command.

Collapse -

Easy one. Used to use it myself.

by neilb@uk In reply to self deleting files, sett ...

the "time" is in seconds for ping to wait for a reply. If you ping an unkown IP, and NOT - repeat, NOT - (try, ping will wait for the specified number of seconds before continuing.

If you ping the local loopback,, ping will come back in 1ms regardless of your timeout value.

Related Discussions

Related Forums