Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- :main
- pushd %~dp0
- rem set arguments
- set arg1=%1
- set arg2=%2
- rem check arguments
- call :check_arg1 %arg1%
- call :check_arg2 %arg2%
- rem import ini files
- set ini=test.ini test2.ini
- for %%i in (%ini%) do call :import_ini %%i
- rem body
- echo arg1=%arg1%
- echo arg2=%arg2%
- echo temp=%temp%
- echo temp2=%temp2%
- popd
- exit /b
- :check_arg1
- if "%1" == "a" (
- rem something to do
- ) else if "%1" == "b" (
- rem something to do
- ) else (
- echo ERROR : wrong argument arg1=%arg1%
- exit
- )
- exit /b
- :check_arg2
- if "%1" == "a" (
- rem something to do
- ) else if "%1" == "b" (
- rem something to do
- ) else (
- echo ERROR : wrong argument arg2=%arg2%
- exit
- )
- exit /b
- :import_ini
- for /f "tokens=1,2* delims==" %%i in (%1) do (
- if not %%i == # (
- set %%i=%%j
- )
- )
- exit /b
- endlocal
Add Comment
Please, Sign In to add comment