Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System

当前位置: 首页 » 技术文章 » Oracle

在Windows上执行For Loop

windows上的For Loop和Linux上还是有些区别的。下面以在Linux和Window上执行oracle的sqlldr为例,我们来写个样本


for i in `ls *.ctl`
sqlldr test/oracle control=$i


 for /r %%i in (*.ctl) do sqlldr test/oracle control=%%i


@echo off
set "fst=0"
set "fib=1"
set "limit=1000000000"
call:myFibo fib,%fst%,%limit%
echo.The next Fibonacci number greater or equal %limit% is %fib%.

::-- Function section starts below here

:myFibo  -- calculate recursively the next Fibonacci number greater or equal to a limit
::       -- %~1: return variable reference and current Fibonacci number
::       -- %~2: previous value
::       -- %~3: limit
set /a "Number1=%~1"
set /a "Number2=%~2"
set /a "Limit=%~3"
set /a "NumberN=Number1 + Number2"
if /i %NumberN% LSS %Limit% call:myFibo NumberN,%Number1%,%Limit%
    IF "%~1" NEQ "" SET "%~1=%NumberN%"


The next Fibonacci number greater or equal 1000000000 is 1134903170.

Windows dostips

DOS - Arithmetic How to use SET /A for arithmetic in DOS
DOS - Experimental Stuff Experiments.
DOS - My First Batch File Learn how to write a DOS batch file yourself.
DOS - Powerful Enablers Basic yet powerful features make DOS a quite interesting script language.
DOS - Script Snippets DOS Batch Script Snippets.
DOS - String Manipulation Basic string manipulation in batch like you are used to from other programming languages.
DOS - String Operations Basic string operations in batch like you are used to from other programming languages.
DOS - XCopy Copy Tips Use XCopy for more than copy. I.e. check if a file is open and more...
DOS Batch - Date and Time Using date and time functions in DOS.
DOS Batch - File Examples A collection of batch files.
DOS Batch - FTP Scripts File Transfer with FTP, One-File Solutions.
DOS Batch - Function Tutorial What it is, why it`s important and how to write your own.
DOS Batch - Functions Keep your batch script clean, call DOS functions.
DOS Batch - Interfacing non DOS Software Embed other languages into your batch, like: Perl, SQL, FTP, ...
DOS Batch - Menus Need a menu? See which of these menu frameworks fits your needs.
DOS Batch - Quine Collection Self-Reproducing Batch Programs created by Peter Hartmann, founder of
DosTips - Sitemap Detailed list of available pages at
DosTips - The DOS Batch Guide Home Page
General Contact information, / terms of use, ... and more
Unit Test Function Library Unit Test for DosTips Functions.


关键词:loop batch windws 


在Windows上执行For Loop
QQ 375349564