欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

用批处理写的:数据库备份还原工具(第三版) 博客分类: 批处理 OracleCC++C#F# 

程序员文章站 2024-03-21 15:53:22
...

这一版加强和修正了菜单选择的判断性

@echo off&setlocal enabledelayedexpansion color 0a 
echo.===================================== 
echo.欢迎使用Oracle数据库自动备份还原工具 
echo.作者:乔磊 MSN:sucre03@live.cn 
echo.=====================================  
for /f "tokens=2 delims==" %%a in ('path') do (
         set "str=%%a"
         set str=!str: =+!
         for %%i in (!str!) do (
                 set "var=%%i"
                 set var=!var:+= !
                 echo !var!>>%temp%\change.txt
   		 for /f "delims=" %%i in ('findstr "Db_1\bin" %temp%\change.txt') do set var=%%i
         )
)
set /p name=用户名(username):
chcp 437 >nul 
graftabl 936 >nul 
>"%temp%\in.com" echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x 
set /p=请输入密码:<nul 
for /f "tokens=*" %%a in ('"%temp%\in.com"') do (
     set "password=%%a" 
) 
set /p sid=空间标识(SID): 
:start 
set /p choice=1.导出 2.导入 3.按任意键退出 
if %choice% equ 1 (goto exp) 
if %choice% equ 2 (goto imp) else (goto end)  
:exp set /p file=给导出的文件起个名: 
set /p path=存放的路径(记得输冒号:): 
"%var%"\exp.exe %name%/%password%@%sid% file=%path%\%file% full=n 
set /p choice=1.继续(输入c) 2.按任意键退出 
if %choice% equ c (goto start) 
if %choice% equ e (goto end) else (goto end) 
:imp 
set /p file=请将要导入的数据库文件拖入窗体内: 
"%var%"\imp.exe %name%/%password%@%sid% file=%file% full=y 
set /p choice=1.继续(输入c) 2.按任意键退出 
if %choice% equ c (goto start) 
if %choice% equ e (goto end) else (goto end) 
:end del /q %temp%\change.txt 
del /q %temp%\in.com 
exit 

 代码相关

EQU equal 
NEQ not equal  
LSS less than 
LEQ less than or equal 
GTR greater than 
GEQ greater than or equal