Enrique Tellez
Enrique Tellez

Reputation: 11

Self Delete .cmd command

Cmd command doesn’t work at startup folder it doesn’t delete itself please help if I double click on it itself delete but if it run runs at startup it shows the message but it won’t self delete.

Echo off 
Hello world

start /b "" cmd /c del "%~f0"&exit /b

Upvotes: 0

Views: 1097

Answers (2)

Compo
Compo

Reputation: 38604

I've always found this to work:

(GoTo) 2> NUL & Del "%~f0"

Upvotes: 0

Crazy God
Crazy God

Reputation: 11

There is a simple delete command start del Filename.bat or del filemname.bat

Upvotes: 1

Related Questions