此文版权属于作者智勇,任何人、媒体或者网站转载、借用都必须征得作者本人同意
CMD 脚本源码:
rem
file: co_revision.cmd
@echo off
rem 版权所有 智勇
if [ %1 ] == [] goto :eof
@echo --------------------------------------------
@echo ... Check out the source from svn server ...
set TMPFILE = tmp . txt
set PRJ_NAME = Hello
set SVR_NAME = svn: // svr_name
set PRJ_PATH =/ Test / World / trunk / Development /
set cmd_str = svn . exe co " %SVR_NAME%%PRJ_PATH%%PRJ_NAME% "
%cmd_str > %TMPFILE%
type %TMPFILE%
for / f " tokens=1,2,3,4 delims=. " %%i in ( 'more %TMPFILE%^|findstr / C: " Checked out revision " ' ) do (
echo # define REVISION_NUMBER %%l > %1 // revision number of %PRJ_NAME%
)
for / f " tokens=2 delims= " %%i in ( ' date / t' ) do (
echo # define BUILD_DATE %%i >> %1
)
del %TMPFILE%
set TMPFILE =
set PRJ_NAME =
set SVR_NAME =
set PRJ_PATH =
set cmd_str =
@echo off
rem 版权所有 智勇
if [ %1 ] == [] goto :eof
@echo --------------------------------------------
@echo ... Check out the source from svn server ...
set TMPFILE = tmp . txt
set PRJ_NAME = Hello
set SVR_NAME = svn: // svr_name
set PRJ_PATH =/ Test / World / trunk / Development /
set cmd_str = svn . exe co " %SVR_NAME%%PRJ_PATH%%PRJ_NAME% "
%cmd_str > %TMPFILE%
type %TMPFILE%
for / f " tokens=1,2,3,4 delims=. " %%i in ( 'more %TMPFILE%^|findstr / C: " Checked out revision " ' ) do (
echo # define REVISION_NUMBER %%l > %1 // revision number of %PRJ_NAME%
)
for / f " tokens=2 delims= " %%i in ( ' date / t' ) do (
echo # define BUILD_DATE %%i >> %1
)
del %TMPFILE%
set TMPFILE =
set PRJ_NAME =
set SVR_NAME =
set PRJ_PATH =
set cmd_str =
使用方法:
co_revision.cmd revision.h