Announcement

Collapse
No announcement yet.

batch script to delete file with result of dir as variable

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • batch script to delete file with result of dir as variable

    hi

    i want this to run

    dir /s /b "filename"

    and then the output of this command to be put into a del command

    i.e

    del /q "OUTPUT OF DIR"

    Thanks

  • #2
    Re: batch script to delete file with result of dir as variable

    Code:
    @echo off
    
    for /f "delims=" %%* in (
      'dir /s /b /A-D "C:\folder\test\*" 2^>nul') do (
      echo."%%*"
      rem ... del /q "%%*"
    )
    \Rems
    Last edited by Rems; 29th June 2010, 11:30.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment

    Working...
    X