Skip to content

Instantly share code, notes, and snippets.

@octavian-nita
Last active December 30, 2015 07:19
Show Gist options
  • Save octavian-nita/7795509 to your computer and use it in GitHub Desktop.
Save octavian-nita/7795509 to your computer and use it in GitHub Desktop.
Batchfile template
@if "%DEBUG%"=="" @echo off
setlocal enabledelayedexpansion
:: =====
:: Command line arguments check:
:: =====
if [%1]==[] (
echo Usage: %0 arg-1 [arg-2] ...
exit /b 1
)
:: Setting / modifying variables in loops -- example (TODO: remove this and place it into a gist):
::
:: set CLASSPATH=WEB-INF\classes
:: for /f %%F in ('dir /b %LIBDIR%') do (
:: set CLASSPATH=!CLASSPATH!;%LIBDIR%\%%F
:: )
:: Delete myself :) ...
:: start /b "" cmd /c del "%~f0"&exit /b
endlocal
exit /b %ERRORLEVEL%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment