How to make .BAT file delete it self after completion?

后端 未结 6 1361
渐次进展
渐次进展 2020-11-29 02:05

How to make .BAT file delete it self after completion? I have a simple bat file that terminates a process. I want that .BAT file to delete itself.

6条回答
  •  天命终不由人
    2020-11-29 02:48

    You could also direct the output of the DEL "%~f0" to NULL output like so...

    @ECHO OFF
    SETLOCAL
    SET someOtherProgram=SomeOtherProgram.exe
    TASKKILL /IM "%someOtherProgram%"
    DEL "%~f0" > NUL
    

提交回复
热议问题