I was asked to deliver a backup-script for a windows-database – really ! However I’m not an o.s.-scripting guru at all and certainly not on Windows, I came to the following. It looks a lot like the one I use on Linux, just tried to translate it into a .cmd-file. The challenge was to get it in one-command file.
I noticed there  are a lot of RMAN backup-scripts, but not very much executed from a cmd-file:

@ECHO OFF
::  file    : backup.cmd
::  description : run rman backup to disk
::
:: Author: Job Oprel
:: Version: 0.1
:: History
:: Version + Date      + Author            + Updates
:: ———————————————————
::  0.1   | 14-05-2010 | Job Oprel         | Initial
::
:: First: date and time setting (RUNDATETIME)
::
for /f “tokens=1-3 delims=: ” %%a in (‘time /t’) do (
set hours=%%a
set minutes=%%b
)
set date1=%date:~3,10%
for /F “usebackq tokens=1,2,3 delims=-” %%i in (`echo %date1%`) do (set RUNDATETIME=%%k%%j%%i-%hours%%minutes%)
::
:: Configuration
:: (you may simply replace this with parameters of course)
::
set ORACLE_SID=Jobacle1
:: rundir==> where the rman-commandfile will be build and run.
:: you must have write-permission to that directory!
set RUNDIR=c:\temp
set LOGDIR=c:\oracle\log
set ORACLE_HOME=c:\oracle\product\10.2.0\db_1
set ORACLE_BASE=c:\oracle\product\10.2.0
set PATH=%ORACLE_HOME%\bin
set NLS_DATE_FORMAT=’DD-MM-YY HH24:MI:SS’
set BACKUPDIR=c:\oracle\oradata\backup
set LOGFILE=%LOGDIR%\%ORACLE_SID%_%RUNDATETIME%.log
set ADDR=’job@jobacle.nl’
set TMPLOG=%LOGDIR%\tmplog.$$
set MAILSERVER=mail.jobacle.net
::
:: Cleaning up of old logfiles will be done in another program
::
:: Build de rman-commandfile
set CMDFILE=%RUNDIR%\%ORACLE_SID%.rman
echo run { > %CMDFILE%
echo CONFIGURE RETENTION POLICY TO REDUNDANCY 2; >> %CMDFILE%
echo CONFIGURE BACKUP OPTIMIZATION ON;  >> %CMDFILE%
echo CONFIGURE DEFAULT DEVICE TYPE TO DISK; >> %CMDFILE%
echo CONFIGURE CONTROLFILE AUTOBACKUP ON;  >> %CMDFILE%
echo CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%BACKUPDIR%\ora_cf%%F'; >> %CMDFILE%
echo CONFIGURE DEVICE TYPE DISK PARALLELISM 2;  >> %CMDFILE%
echo CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;  >> %CMDFILE%
echo CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;  >> %CMDFILE%
echo CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‘%BACKUPDIR%\ora_df%%t_s%%s_s%%p'; >> %CMDFILE%
echo CONFIGURE MAXSETSIZE TO UNLIMITED;  >> %CMDFILE%
echo CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘%BACKUPDIR%\snapcf_%ORACLE_SID%_%RUNDATETIME%.f'; >> %CMDFILE%
:: explicitly names the format in the allocate channel
echo ALLOCATE CHANNEL C1 TYPE DISK FORMAT ‘%BACKUPDIR%\ora_df%%t_s%%s_s%%p'; >> %CMDFILE%
echo SHOW ALL; >> %CMDFILE%
echo sql “alter system archive log current”; >> %CMDFILE%
echo DELETE FORCE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE ‘sysdate-1′; >> %CMDFILE%
echo BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL=0 DATABASE INCLUDE CURRENT  CONTROLFILE PLUS ARCHIVELOG; >> %CMDFILE%
echo sql “alter database backup controlfile to trace as ”%BACKUPDIR%\ctrlfile_%ORACLE_SID%_%RUNDATETIME%””; >> %CMDFILE%
echo CROSSCHECK BACKUP; >> %CMDFILE%
echo REPORT OBSOLETE; >> %CMDFILE%
echo DELETE FORCE NOPROMPT OBSOLETE; >> %CMDFILE%
::
:: RMAN don’t like the following in the run-command apparently…
::
:: echo LIST BACKUP OF DATABASE; >> %CMDFILE%
:: echo LIST BACKUP OF ARCHIVELOG ALL; >> %CMDFILE%
:: echo LIST BACKUP; >> %CMDFILE%

echo release channel c1; >> %CMDFILE%
echo }  >> %CMDFILE%

:: End of Command File Generation
echo Starting the script > %LOGFILE%
%ORACLE_HOME%\bin\rman target / @%CMDFILE% msglog=%TMPLOG% >>%LOGFILE%
::
:: merge the two logfiles
type %TMPLOG% >> %LOGFILE%
::
:: checking for errors
::
findstr /i “RMAN-06273″ %LOG%
:: mailing through ‘bmail’ for example
::    (http://www.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm)
if errorlevel 0 if not errorlevel 1 bmail -s %MAILSERVER% -t %ADDR% -f “Database”-m %LOGFILE%
@echo on