Frage

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 ?

War es hilfreich?

Lösung

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"
)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top