Thursday, June 9, 2011

Bat Pragramming

params.txt
region 25
nation 100
supplier 5000

@echo off
set ORACLE_PWD=orcl
set NLS_NUMERIC_CHARACTERS=.,
setlocal
echo "Run number " %1
For /F "tokens=1,2" %%X in (params.txt) do (
echo sqlldr userid='sys/%ORACLE_PWD% as sysdba' log=%%X%1.log control=%%X.ctl direct=true rows=%%Y multithreading=true
)

-------------------------------------------------------------------------------------------------------------------

@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

:menuLOOP
echo.
echo.= Menu =================================================
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C
set choice=
echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF
echo.&call:menu_%choice%
GOTO:menuLOOP

::-----------------------------------------------------------
:: menu functions follow below here
::-----------------------------------------------------------

:menu_1 Have some fun
echo.Have some fun by adding some more code right here
GOTO:EOF

:menu_2 Get a water
echo.Get a water and then add some code right here
GOTO:EOF

:menu_

:menu_T Tip
echo.It's easy to add a line separator using one or more fake labels
GOTO:EOF

:menu_C Clear Screen
cls
GOTO:EOF