Pregunta

If I have a file named " mic.txt" on a Hard drive, What are the codes that find this file and delete it ??

If batch files can't do this, What are there any other ways ?

¿Fue útil?

Solución

delete_my_file.bat

@echo off
set file_to_delete=mic.txt
set dir_to_look_in=C:\

:: Starting loop
for /f "tokens=1* delims=" %%f in ('dir /s /o /b "%dir_to_look_in%" ^| findstr "%file_to_delete%"') do (
    echo INFO: Deleting: %%f
    del /q "%%f"
)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top