Question Locked

self deleting files, setting a delay time

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi
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 127.0.0.1 -n 1 -w "time" >NUL
DEL "file"
DEL %0
EXIT

thanks

3 replies

by Former member

Clarifications

by seanferd

-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.

by Member 25348569

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

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

:D

This discussion is closed to new replies.