Batch File Problem

June 29, 2011 at 22:42:49
Specs: Windows XP
Hello all,

I am going to make a batch file but i am facing some problem here the code i am using

@echo off
cd "D:\"
If NOT EXIST "D:\Orabackup" md "D:\Orabackup" & Goto :_ORA
:_ORA
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do set fdate=%%a%%b%%c
for /f "tokens=1,2,3,4,5 delims=: " %%a in ('time /t') do set ftime=%%a%%b%%c%%d%%e
exp userid=Naveed/Turabali1@IMS file=D:\Orabackup\IMS%fdate%%ftime%.dmp log=D:\Orabackup\LOG%fdate%%ftime%.log
rem If EXIST "D:\Orabackup%_num%"&Goto:ORA
rem md "D:\Orabackup%_num%"

when i run this script it makes a folder Orabackup in d drive but it does not execute the backup statement i.e when it checks folder exists it should take backup in it and if folder not exists it should make the folder and take the backup

Please help me


See More: Batch File Problem

Report •


#1
July 3, 2011 at 11:05:49
@echo off

cd "D:\"
If EXIST "D:\Orabackup" Goto:NEXTSECTION
::this line skips the next four if it does exist, otherwise it continues down
md "D:\Orabackup"
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do set fdate=%%a%%b%%c
for /f "tokens=1,2,3,4,5 delims=: " %%a in ('time /t') do set ftime=%%a%%b%%c%%d%%e
exp userid=Naveed/Turabali1@IMS file=D:\Orabackup\IMS%fdate%%ftime%.dmp log=D:\Orabackup\LOG%fdate%%ftime%.log
::if you just skip past the past 4 lines if it does exist, you dont have to worry about
::stringing the miltiple lines

:NEXTSECTION
::Whatever else you need goes after this

mike


Report •

#2
July 3, 2011 at 11:11:13
@echo off
cd d:\
If EXIST D:\Orabackup Goto:NEXTSECTION
::this line skips the next four if it does exist, otherwise it continues down
md D:\Orabackup
for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do set fdate=%%a%%b%%c
for /f "tokens=1,2,3,4,5 delims=: " %%a in ('time /t') do set ftime=%%a%%b%%c%%d%%e
exp userid=Naveed/Turabali1@IMS file=D:\Orabackup\IMS%fdate%%ftime%.dmp log=D:\Orabackup\LOG%fdate%%ftime%.log
::if you just skip past the past 4 lines if it does exist, you dont have to worry about
::stringing the miltiple lines
:NEXTSECTION
::Whatever else you need goes after this

::sorry didnt need the quotes around the names ether i dont think

mike


Report •

#3
July 4, 2011 at 11:24:16
Sorry it is not working when i run the script it just make the folder and does nothing else

Report •
Related Solutions


Ask Question