Skip to content

Instantly share code, notes, and snippets.

@fushnisoft
Created April 19, 2012 10:48
Show Gist options
  • Save fushnisoft/2420211 to your computer and use it in GitHub Desktop.
Save fushnisoft/2420211 to your computer and use it in GitHub Desktop.
Example pre-build script for cancelling build if exe file is already open
ECHO off
:delfile
del %1%
if exist %1% goto fail
goto end
:fail
ECHO Unable to delete %1%, you probably still have it open!
EXIT /B 1
:end
:: Put this bat file in your pre-build event to cancel the build if the file is already open
:: Call like this: del.bat MyProgram.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment