Skip to content

Instantly share code, notes, and snippets.

@aracknobus
Created February 25, 2016 14:29
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 aracknobus/13b3a87d6100183b6ba0 to your computer and use it in GitHub Desktop.
Save aracknobus/13b3a87d6100183b6ba0 to your computer and use it in GitHub Desktop.
Simple cmd script to make a debug-like command-line switch and setting
@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
:: Name: DebugSwitchTemplate.cmd
:: Author: Aracknobus
:: Version: v0.1 - Feb '16
::
::
SET DEBUGVAR=0
SET DEBUGECHO=0
SET DEBUGCMD=0
IF "%DEBUGVAR%" EQU "1" SET DEBUG=1
IF "%1"=="/debug" SET DEBUG=1
IF "%DEBUG%" EQU "1" (
SET DEBUGECHO=ECHO
SET DEBUGCMD=ECHO %~n0:
) ELSE (
SET DEBUGECHO=REM
SET DEBUGCMD=
)
shift
:: Main
cls
%DEBUGECHO% Hello World!
%DEBUGCMD% echo %~n0: Simple echo line visible only in debug mode
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment