ScriptSuicide.vbs

'=========================================================================
' ScriptSuicide.vbs
' VERSION: 1.0
' AUTHOR: Brian Steinmeyer
' EMAIL: sigkill@sigkillit.com
' WEB: http://sigkillit.com
' DATE: 1/1/2011
' COMMENTS: Deletes the current script. This is useful when you are running
' scripts to automate tasks such as installations, logins, etc and you want
' to remove the script after it executes.
' EXAMPLE: Call ScriptSuicde()
'=========================================================================
Option Explicit

Call ScriptSuicide()

Private Sub ScriptSuicide()

    On Error Resume Next

    Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.DeleteFile WScript.ScriptFullName
    Set objFSO = nothing

    On Error GoTo 0

End Sub

 

Leave a Reply

Your email address will not be published. Required fields are marked *