just what I think,any reply ,thx~~
I want to delete some file automaticly every two minutes..
such as, every two minutes,delete a file a.exe in d:\aa\bb\cc> ;)
Printable View
just what I think,any reply ,thx~~
I want to delete some file automaticly every two minutes..
such as, every two minutes,delete a file a.exe in d:\aa\bb\cc> ;)
here's i file i made you that waits for about 120 seconds depending on you machine. just call it from your bat and goto the beginning.
As malicious as this may sound like you're trying to delete files off someones computer try looking in google for a Microsoft Windows NT 4.0/2000 utility called Sleep.exe, it should be free and you execute it in a batch file as
sleep (interval in seconds)
cmd
This sounds like a prank/malicious batch file your making... I don't know why people are helping you out with this one. :rolleyes:
It is just a ieda... :)
becase we share information :) and besides, a quick google search would have given him a lot more, but these damn newbies are too lazy to do a search and find some information for themselves.Quote:
I don't know why people are helping you out with this one.
damn???hehe...
I got an idea just now, please have a look :
@echo on
:START
ping 1.1.1.1 -n 60
del D:\bb\aa\cc\*.exe
goto START
:)
hmmm, so your making the program ping a certain IP 60 times, then delete a file off your D:\ drive.... smart... then your repeating it all over again? Why?
My interrpertation of your batch file might have been a little bit off (I haven't seen it in a while).. but i think its wrong for what your trying to do. From wat i can tell... your pinging an IP 60 times. I'm not entirely sure what this is supposed to accomplish :rolleyes: also, from what i can tell, your deleting a file off of your D:\ drive... I don't believe you can write batch files to delete other peoples files remotely....
Anyone else questioning his motives? :confused:
I think what he's trying to do is connect to a remote server( i guess) and then delete a file from the IP's computer......ugh..
[sarcasm]why bother...sending a virus is easier....[/sarcasm]
oh why not, i dont have anything better to do
To suppress the prompting use the deltree command and add the tag /y. Here is an example of how the whole command would look, deltree c:\windows\temp\*.* /y however this does not work in all versions of Windows and or DOS.
If this command does not work we would recommend that you create a batch file with the following source: "echo y | del %1\*.*" (without the quotes) once created, you can type the name of the batch file then the name of the directory that you wish to delete.
To delete all files from a directory, you could use:
DEL *.*
DEL will then ask you to confirm that you want to delete all files.
In batch files, this would stop the execution of the batch file and require user interaction, which usually isn't what batch files are intended for.
http://www.robvanderwoude.com/index.html
http://www.computerhope.com/issues/ch000010.htm
similar problem to yours
Dear Expert GURU,
I'm needing to set up a simple batch script to run every day to delete old backup files which are older than 7 days. Is there an easy way to do this with windows batch scripting? I have a different task which runs with a 'copy' command however, I can't find a good script to delete old files! Thanks for your help, judging upon how much i 'need' this script quickly, I've allocated 350 points to this question! --Devon D.
replies:
Greetings snowdizx,
This may be the quickest/easiest solution for you:
http://www.michna.com/software.htm#DelOld
Specify the file types you want to delete along with the age...
DelOld.exe C:\TEMP\*.* 7
Obsolete is another tool for this: http://users.aol.com/pasacaca/obsolete/obsolete.zip
Or you can try SteveGTR's solution here: http://www.experts-exchange.com/Oper..._20947290.html
Source: http://www.experts-exchange.com/Oper..._20988259.html
what a quick google search can do....
Well I am totally confused.
1. There is no delay instruction, so it will just go into an infinite loop?
2. Why ping an IP 60 times? I would have thought that you either get a positive or negative response? where are the instructions on what to do if you do/don't get a response?
3. If the file to be deleted is really an .exe, why do you need to delete it more than once? It isn't going to re-generate itself is it?
:confused:
nihil you can do that with a bat. when you want it to stop you just ^c
It did kinda sound like he wanted to delete a file off a remote system,and nihil...I think that the exe bit's just an example..and why would you want to drive your bat file into an infinite loop Tedob1?for deleting a directory anyways...beats me..:(
The idea for this does sound a bit off... but I just wanted to add...
If you are trying to delete all the files in a certain directory over a specific period of time, and those files are in use at the time... your batch script will error out... I *think*. I haven't tried it. I remember having that problem with some of my batch files a while ago.
Spyrus was right though. You can use sleep to "pause" your the script for that time.
Then just loop it like you were.
I beleive that sleep.exe comes with the resouce kit?
If he wanted to delete files off of a remote computer... all that he'd have to make sure of is:
1. Have appropriate credentials with permission (Filesystem ACLs).
2. Have a drive mapped to a share that includes the folder/files to be deleted.
I do it all the time....
Personally, I use the task scheduler to run my batch files though. They are only run in the middle of the night when I need update certain files... I'm not looping like you are and I know that those files are not in use at the time.
Although I couldn't understand exactly, thx for all help,
and somebody give this ,have a look please:
::Delay@Batch
@echo off
if '%1'=='' goto Usage
set /a delay=%1
:delay
set /a delay=%delay%-1
if %delay% GTR 0 goto delay
goto :eof
:Usage
echo Use %0 DelayTime
eh??? Maybe tomyahoo was attempting to set the timeout period of the ping command and then delete the file, making ping timeout after 60 seconds...you never know. If it was pinging an ip that didn't exist at the time then that would work to make the program sleep. lol...what a method :P
Sleep's the most obvious one though. Doesn't it come with XP? I'm sure it came with all the win9x releases.
I know this isn't strictly related to this thread, but I made a nice wee script to detect new connections using netstat on my linux box. Unfortunately it's a bit limited, but seems to work. It involves dumping the output of netstat to a file and then a while later dumping it to another file then comparing the two files and outputting any differences.
anyhow...enough blethering.
ac
Gothic~
The XP command is "delay" n Seconds
I still don't understand pinging a static IP address 60 times, particularly in an infinite loop like he had at first..........that could be taken as a DoS attack?
I also don't understand "*.exe"..............that would select all . exe files in the path? And if you don't want .exes, why install them in the first place.
Why do it more than once? they won't come back of their own accord. If they are being used you will get an error unless they are programs that load into memory, in which case the system will produce error messages on the next reboot?
I could just about understand clearing system generated temporary files to save space, but you would have to wait for the programs using them to finish with them or you would most likely get an error, as they will be object locked?
If you want to do it from a security viewpoint you would need some sort of overwriting algorithm anyway?
Tomyahoo, can we see your PROGRAM SPECIFICATION. What is it you are trying to do / achieve?
I am afraid you will not get much help until we understand the objectives of the program.
:confused: