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为例,我们来写个样本

Linux

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

Windows

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

下面是关于斐波那契数的一个batch脚本Fibonacci.bat

@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%.
echo.&pause&goto:eof

::--------------------------------------------------------
::-- 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
SETLOCAL
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%
(ENDLOCAL
    IF "%~1" NEQ "" SET "%~1=%NumberN%"
)
goto:eof 

执行结果

C:\>Fibonacci.bat
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.com.
DosTips - Sitemap Detailed list of available pages at dostips.com
DosTips - The DOS Batch Guide Home Page
General Contact information, DosTips.com / CmdTips.com terms of use, ... and more
Unit Test Function Library Unit Test for DosTips Functions.

Reference

https://www.dostips.com/DtGeneSitemap.php

http://tldp.org/pub/Linux/docs/HOWTO/translations/it/pdf/DOS-Win-to-Linux-HOWTO.pdf

http://www.brescianet.com/appunti/infobase/dosbatch.htm


关键词:loop batch windws 

相关文章

在Windows上执行For Loop
Top
Cell186-9589-1286
QQ 375349564
E-mail ohsdba@qq.com