I am using the below code:
Func _SelfDelete()
Local $cmdfile
FileDelete(@TempDir & "\dcp.cmd")
$cmdfile = ':loop' & @CRLF _
& 'del "' & @ScriptFullPath & '"' & @CRLF _
& 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
& 'del ' & @TempDir & '\dcp.cmd'
FileWrite(@TempDir & "\dcp.cmd", $cmdfile)
;Run(@TempDir & "\dcp.cmd", @TempDir, @SW_HIDE)
Run(@TempDir & "\dcp.cmd", @TempDir)
EndFunc
It doesnt work on all com