How to make a batch file delete itself?

前端 未结 9 960
遇见更好的自我
遇见更好的自我 2020-11-28 06:07

Is it possible to make a batch file delete itself?

I have tried to make it execute another file to delete it but this did not work.

Does any one know how I cou

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 06:18

    ( del /q /f "%~f0" >nul 2>&1 & exit /b 0  )
    

    Set this at the end of the script. (might not work if SHIFT command is used)

提交回复
热议问题