局域网共享文件自动更新办法
局域网文件更新,
强制结束进程
TASKKILL /F /IM ERP.Main.exe /T
如果服务器上版本较新,则更新本地
xcopy %远程%\更新版本*.bat . /d /y
代码示例
PowerShell 全选
@echo off
echo 结束进程
TASKKILL /F /IM ERP.AttendMonitor.exe /T
TASKKILL /F /IM ERP.Main.exe /T
echo 文件夹校验
Set 远程=\\192.168.1.24\vss_erp\ERP
if not exist .\config md .\config
if not exist .\de md .\de
if not exist .\es md .\es
if not exist .\help md .\help
if not exist .\images md .\images
if not exist .\ImportAttendProvider md .\ImportAttendProvider
if not exist .\ja md .\ja
if not exist .\Reports md .\Reports
if not exist .\ru md .\ru
echo 文件夹属性校验
attrib .\config -r
attrib .\de -r
attrib .\es -r
attrib .\help -r
attrib .\images -r
attrib .\ImportAttendProvider -r
attrib .\ja -r
attrib .\Reports -r
attrib .\ru -r
echo 更新子文件夹内容
Attrib +s +h %远程%\Config\user.ini
Attrib +s +h %远程%\Config\SystemSettings.xml
Attrib +s +h %远程%\Config\GridSettings.xml
xcopy %远程%\Config\*.* .\config\ /d /y
Attrib -s -h %远程%\Config\user.ini
Attrib -s -h %远程%\Config\SystemSettings.xml
Attrib -s -h %远程%\Config\GridSettings.xml
xcopy %远程%\de\*.* .\de\ /d /y
xcopy %远程%\es\*.* .\es\ /d /y
xcopy %远程%\help\*.* .\help\ /d /y
del .\images\16_Edit.ico /s /f
xcopy %远程%\images\*.* .\images\ /d /y /c
xcopy %远程%\ImportAttendProvider\*.* .\ImportAttendProvider\ /d /y
xcopy %远程%\ja\*.* .\ja\ /d /y
xcopy %远程%\Reports\*.* .\Reports\ /d /y
xcopy %远程%\ru\*.* .\ru\ /d /y
echo 更新所需EXE
xcopy %远程%\*.exe . /d /y
echo 更新所需DLL
xcopy %远程%\*.dll . /d /y
xcopy %远程%\AttendImporter.ini . /d /y
echo 更新升级批处理
xcopy %远程%\更新版本*.bat . /d /y
start .\ERP.Main.exe
exit
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
post 管理员