Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access开发平台

Access快速开发平台--实用好用的批处理

时 间:2018-06-22 12:11:30
作 者:lmqlt   ID:18637  城市:广州
摘 要:Access快速开发平台实用好用的批处理
正 文:

      批处理是比较基本的应用,将批处理与大系统相结合,将方便研发人员和管理人员,并大大减少工作量和差错率。

压缩包1:自己整理了一个升级包生成批处理,运行批处理自动将设定的文件夹内容生成一个自解压文件(无需手动设置是否静默、解压覆盖等);

压缩包2:在程序里可根据版本不同,自动生成批处理并运行,无需快速开发平台函数库支持,减少升级差错可能,同时也使程序更简洁、智能。

附   件:

点击下载此压缩包1的附件 

点击下载此压缩包2的附件


升级包制作批处理:调用WinRAR压缩软件对相应文件夹压缩,自动生成统一的升级包。

@echo off
color 9F 
echo:
echo                              说   明
echo _________________________________________________________________
echo:
echo 即将“C:\lgcnew”制作成升级包,请移除“Update.mde”等无需升级文件,
echo 准备好后按任意键开始。
echo _________________________________________________________________
echo:
pause
echo:


(echo Path=C:\
echo Silent=1
echo Overwrite=1)>int.txt
C:\Progra~1\WinRAR\winrar.exe a -sfx -ep1  -m5 c:\lgcsj.exe  C:\lgcnew
C:\Progra~1\WinRAR\winrar.exe c -zint.txt c:\lgcsj.exe
del "int.txt"
echo:
echo                              备   注
echo _________________________________________________________________
echo:
echo 升级包制作成功,请在c:\下拷贝"lgcsj.exe"至服务器,
echo 以便客户端自动升级程序。
echo _________________________________________________________________
echo:
@ echo. & pause


Function Qclj() '清除垃圾
Dim temp As String
temp = "@echo off" & vbCrLf & "echo 正在清除系统垃圾文件,请稍等......" & vbCrLf & _
    "del /f /s /q %systemdrive%\*.tmp" & vbCrLf & _
    "echo. & pause"
Open "c:\Qclj.bat" For Output As #1
Print #1, temp
Close 1
Shell "cmd /c C:\Qclj.bat", 1 '要不显示运行 ,用vbHide代替“1”


End Function

ACCESS生成批处理并运行程序
Function Xtsz() '系统设置
On Error Resume Next
Open "C:\Xtsz.bat" For Output As #1
Print #1, "@echo off "
Print #1, "color 9F"
Print #1, "title [离退休系统升级程序]"


Print #1, "if ""%1"" == ""h"" goto begin"
Print #1, " mshta vbSScript:createobject("; wscript.Shell; ").run(""%~nx0 h"",0)(window.close)&&exit"
Print #1, ": begin"


Print #1, "ping 127.0.0.1 -n 5"
Print #1, "REG ADD ""HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Access\Security"" /v ""Level"" /t REG_DWORD /d ""1"" /f"
Print #1, "REG ADD ""HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Access\Security"" /v ""Level"" /t REG_DWORD /d ""1"" /f"
Print #1, "REG ADD ""HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security"" /v"; "vbawarnings"" /t REG_DWORD /d ""1"" /f"
Print #1, "REG ADD ""HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security"" /v ""vbawarnings"" /t REG_DWORD /d ""1"" /f"
Print #1, "REG ADD ""HKEY_CURRENT_USER\Software\Microsoft\Shared Tools\Graphics Filters\Import\JPEG\Options"" /v ""ShowProgressDialog"" /t REG_SZ /d ""No"" /f"
Print #1, "REG ADD ""HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Graphics Filters\Import\JPEG\Options"" /v ""ShowProgressDialog"" /t REG_SZ /d ""No"" /f"
Print #1, "REG ADD HKEY_CLASSES_ROOT\MSPaper.Document /v EditFlags /t REG_DWORD /d 65536 /f"
Print #1, "REGSVR32.EXE /s MSCOMCTL.OCX"
Print #1, "REGSVR32.EXE /s MSCOMCT2.OCX"
Print #1, "ping 127.0.0.1 -n 3"
Print #1, "del ""C:\Xtsz.bat"" "
Print #1, "echo. & pause"
Close #1


Set ws = CreateObject("Wscript.Shell")
ws.Run "cmd /c C:\Xtsz.bat", 1 '要不显示运行 ,用vbHide代替“1”


End Function




Function sjcx() '系统升级
On Error Resume Next
If Dir("C:\lgcsj.exe") <> "" Then Kill "C:\lgcsj.exe"
Open "C:\sjcx.bat" For Output As #1


Print #1, "@echo off "
Print #1, "color 9F"
Print #1, "title [离退休系统升级程序]"




Print #1, "if ""%1"" == ""h"" goto begin"
Print #1, " mshta vbSScript:createobject("; wscript.Shell; ").run(""%~nx0 h"",0)(window.close)&&exit"
Print #1, ": begin"


Print #1, "SET wait=ping -n 2 127.0.0.1 ^>^nul"
Print #1, "for /l %%n in (5,-1,0) do ("
Print #1, "   rem cls"
Print #1, "    echo **************************************"
Print #1, "    echo."
Print #1, "    echo    更新离退休系统,请耐心等待...      %%n"
Print #1, "    echo."
Print #1, "    echo **************************************"
Print #1, "    %wait%"
Print #1, "    cls"
Print #1, "   )"
Print #1, " set ftpUser=lgc"          '服务器用户名
Print #1, " set ftpPass=8311****"     '登陆密码
Print #1, " set ftpIP=192.168.2.2"    'IP地址
Print #1, " set ftpFolder=/lgc/"      'FTP文件夹
Print #1, " set LocalFolder=C:/"      '下载升级包至客户端位置
Print #1, " set ftpFile=%temp%/TempFTP.txt"
Print #1, ">""%ftpFile%"" ( " & vbCrLf & _
          "echo,%ftpUser%" & vbCrLf & _
          "echo,%ftpPass%" & vbCrLf & _
          "echo cd ""%ftpFolder%""" & vbCrLf & _
          "echo lcd ""%LocalFolder%""" & vbCrLf & _
          "echo bin" & vbCrLf & _
          "echo mget *.*" & vbCrLf & _
          "echo bye" & vbCrLf & _
          ")"
Print #1, "start /min ftp -v -i -s:""%ftpFile%"" %ftpIP%"
Print #1, "ping /n 5 127.0.0.1>nul"

Print #1, ":jiancha "
Print #1, "dir /a-d C:\lgcsj.exe >nul 2>nul"
Print #1, "if %errorlevel%==0 (goto :yunxin) else ping /n 2 127.0.0.1>nul & goto :jiancha"

Print #1, ":yunxin"
Print #1, "start/wait """"  ""C:\lgcsj.exe"""
Print #1, "ping /n 3 127.0.0.1>nul"
'Print #1, "start """"  ""C:\lgcnew\Main.mde"""

Print #1, ":jiancha1 "
Print #1, "dir /a-d C:\lgcsj.exe >nul 2>nul"
Print #1, "if %errorlevel%==0 (goto :try) else ping /n 1 127.0.0.1>nul & goto :jiancha1 "

Print #1, ":try"
Print #1, "del /a /f /q ""C:\lgcsj.exe"""
Print #1, "echo 完成新程序安装,感谢你的大力支持!"
Print #1, "del ""C:\sjcx.bat"""
Print #1, "Exit"
Close #1

Set ws = CreateObject("Wscript.Shell")
ws.Run "cmd /c C:\sjcx.bat", 1 '要不显示运行 ,用vbHide代替“1”

End Function



Access快速开发平台QQ群 (群号:321554481)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助