标题: [文件操作] 批处理提示运算符不存在,再大神帮忙看看脚本还有哪些问题? [打印本页]
作者: hongliang 时间: 2017-2-9 14:42 标题: 批处理提示运算符不存在,再大神帮忙看看脚本还有哪些问题?
- @echo off
- set CurPath=%~dp0
- cd..
- echo %cd%
- set "SaveProPath=CT"
- ::-------------------------------------------------------------------------------
- ::创建日期
- set curdate=%date%
- set d1=%curdate:~0,4%
- set d2=%curdate:~5,2%
- set d3=%curdate:~8,2%
- set curdate=%d1%-%d2%
- set curtime=%time%
- set /a newtime=%curtime::=%
- set /a newtime=%newtime%+1000000
- set SaveTime=%d1%%d2%%d3%_%newtime:~1,6%
-
- set "DestPath=C:\Program Files\Radar\CT\Config"
- ::创建备份包名称
- set "%cd%\备份"
- set "%cd%\备份\%SaveProPath%\%curdate%_%SaveTime%"
- md "%cd%\备份\%SaveProPath%\%curdate%_%SaveTime%"
-
- ::拷贝config
- xcopy "%cd%\Config" "%cd%" /S /E /K /Y
-
- ::WebAir打包
-
- "%cd%\7za.exe" a -tzip "%cd%.zip" "%cd%\"
- pause
- echo
复制代码
作者: hongliang 时间: 2017-2-9 15:06
我想将当前批处理所处位置动态获取当前路径中的指定文件夹备份到另一个文件夹,之前使用绝对路径能成功,换成动态获取有点问题,哪位大神帮忙瞅瞅.............
作者: GNU 时间: 2017-2-9 16:03
把 @echo off 删掉再执行,可以看到是哪一行在报错。把具体信息发出来
作者: hongliang 时间: 2017-2-9 16:17
已经搞定了
作者: GNU 时间: 2017-2-10 10:39
回复 4# hongliang
发出来让大家引以为戒吧
作者: hongliang 时间: 2017-2-14 15:39
set CurPath=%~dp0
cd..
echo %cd%
set approot=%cd%
::-------------------------------------------------------------------------------
::创建日期
set curdate=%date%
set d1=%curdate:~0,4%
set d2=%curdate:~5,2%
set d3=%curdate:~8,2%
set curdate=%d1%-%d2%
set curtime=%time%
set /a newtime=%curtime::=%
set /a newtime=%newtime%+1000000
set SaveTime=%d1%%d2%%d3%_%newtime:~1,6%
cd..
::创建备份包名称
md "%cd%\PT备份\%curdate%_%SaveTime%"
md "%cd%\PT备份\%curdate%_%SaveTime%\Config"
md "%cd%\PT备份\%curdate%_%SaveTime%\Plugin"
::拷贝config
xcopy "%approot%\Config" "%cd%\PT备份\%curdate%_%SaveTime%\Config" /S /E /K /Y
xcopy "%approot%\Plugin" "%cd%\PT备份\%curdate%_%SaveTime%\Plugin" /S /E /K /Y
xcopy "%approot%\PackageVer.xml" "%cd%\PT备份\%curdate%_%SaveTime%" /K /Y
xcopy "%approot%\Ver.xml" "%cd%\PT备份\%curdate%_%SaveTime%" /K /Y
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |