Windows Batch Script: parse arguments








@echo off
setlocal EnableExtensions EnableDelayedExpansion

set verbose=false
set value=

:loop
if "%~1"=="" (
    if "%~1"=="--help" (
        call :help
        exit /b 0
    )
    if "%~1"=="--value" (
        set value=%~2
        shift
        shift
        goto :loop
    )
    if "%~1"=="--verbose" (
        set verbose=true
        shift
        goto :loop
    )
    shift
    goto :loop
)


see also




No comments:

Post a Comment