|
Answer» Ok i would like to make a simple BATCH SCRIPT that would search for certain files on my system then delete them without prompt.
It has to work with xp pro & ALSO VISTA.
I would also like to find out how to replace files with a updated version of a file.
Lets say i have a file called somename.jpg and i got a more updated file called somename.jpg could i use batch to replace the over version without prompt.
I used to know a little batch but i forgot most of it and with vista the commands seem to have changedThis sounds like 2 questions with 2 solutions. For the 1st part about finding and deleting, you can do something like: Code: [Select]@echo off set FindMask=*.tmp for /f "tokens=*" %%a in ('dir "%FindMask%" /a /s /b') do echo del /q "%%a" Be careful with this because you could easily delete a lot of files. I left an echo on, so you can see what will be deleted first. Finds your file
echo off CLS if "%1"=="" GOTO Labl CHKDSK/V|FIND "%1" /I|more
(XXXXX)
goto end :Labl echo You forgot to enter a filename. Type YOURNM.BAT [filename] echo then press Enter :end
save as YOURNM.bat
Modify to include your deletion at XXXX.
Perhaps echo Y | DEL *.* > nul:, but test it out on dummyfile/dir first
Will search without the whole filename or extension. Finds every occurance including directory names.
***************************************************************
Prob 2:
echo Y | copy B:\new.txt C:\new.txt > nul: Andy
|