Skip to content

Instantly share code, notes, and snippets.

@gitSambhal
Created September 11, 2023 08:38
Show Gist options
  • Save gitSambhal/48134eff1f2410345bb08f5811d369dc to your computer and use it in GitHub Desktop.
Save gitSambhal/48134eff1f2410345bb08f5811d369dc to your computer and use it in GitHub Desktop.
Batch file with functions
@echo off
echo PROGRAM_NAME:%~nx0 Start
echo.
================================
SET debugMode=%1
call :myFunc1 %debugMode%
call :myFunc2 para1 "para2 hello"
================================
echo PROGRAM_NAME:%~nx0 End & pause>nul
EXIT /B
:: 👇 define the function under below
:myFunc1 <isDebug>
:: So that you can know the %1 means: isDebug.
if "%1" == "1" (
echo debug mode
)
EXIT /B
:myFunc2 <para1> <para2>
:: output: para1
echo %1
:: output: "para2 hello"
echo %2
EXIT /B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment