Skip to content

Instantly share code, notes, and snippets.

@nerflad
Created July 14, 2016 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerflad/ad96d53e70954d137e958514fb619672 to your computer and use it in GitHub Desktop.
Save nerflad/ad96d53e70954d137e958514fb619672 to your computer and use it in GitHub Desktop.
Self Deleting Batch Script
:: Delete self, handy for scripts you need manually
:: copy and deploy to lots of machines
:: Pretty sure I stole this from SS64.
set "batchPath=%~0"
echo Set objFSO = CreateObject( "Scripting.FileSystemObject" ) > "%~dp0temp.vbs"
echo objFSO.DeleteFile( "!batchPath!" ) >> "%~dp0temp.vbs"
echo objFSO.DeleteFile WScript.ScriptFullName >> "%~dp0temp.vbs"
echo WScript.Quit >> "%~dp0temp.vbs"
"%~dp0temp.vbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment