建立一个txt文本文件在里面写上

@echo off //批处理命令
set sid=jhemr//数据库名称
set username=disea//用户名
set password=disease//密码
set connect=%username%/%password%@%sid%  命令集
set back_path=d:\项目备份//项目备份的位置
set date_string=%date:~0,4%_%date:~5,2%_%date:~8,2%//日期
set time_string=%time:~0,2%_%time:~3,2%_%time:~6,2%//时间
set file_string=%back_path%\az_%date_string%_%time_string%//文件名  
exp %connect% file=%file_string%.dmp INDEXES=y grants=y constraints=y compress=y//备份数据库

forfiles /p d:\项目备份 /m *.zip -d -7 /c "cmd /c del /f @path"
"F:\HaoZip\HaoZip.exe"  %back_path%\az_%date_string%_%time_string%.dmp//将备份的数据库压缩  注意"F:\HaoZip\HaoZip.exe" 要找到自己本机的压缩文件路径
del %back_path%\az_%date_string%_%time_string%.dmp  //压缩后删除原来备份的未压缩文件

如果不需要压缩可以删除后两行

其实这就是一些dos命令的批处理

写完后 将文件后缀名改成.bat 双击运行就可以了        

相关文章:

  • 2021-05-16
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2021-08-23
  • 2022-01-21
  • 2021-11-12
  • 2022-01-17
猜你喜欢
  • 2021-08-15
  • 2021-10-30
  • 2022-12-23
  • 2022-01-31
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
相关资源
相似解决方案