...

View Full Version : Batch file - storing results of exe command



Dan06
08-26-2009, 05:58 PM
I want to execute a command in my batch file, and store those results for later use in the same batch file. Anyone know how to do this? Below is what I have so far.



@ECHO OFF
SET REPOS=%1
SET REV=%2
SET WORKSPACE=D:\apache\htdocs

REM I want to execute svnlook.exe and store its results (list of path values) in CHANGES
SET CHANGES="svnlook changed %REPOS% -r %REV%"

ECHO. %DATE% >> D:\svn_log.txt
ECHO. %TIME% >> D:\svn_log.txt
ECHO. %WORKSPACE% >> D:\svn_log.txt
ECHO. %REPOS% >> D:\svn_log.txt
ECHO. %REV% >> D:\svn_log.txt
ECHO. %CHANGES% >> D:\svn_log.txt

FOR /F %%a IN (`%CHANGES%`) DO (D:\Subversion\bin\svn.exe update %%a)

ckeyrouz
08-26-2009, 06:07 PM
I think you can execute the svnlook and put the result in a temp file and then read the text from that file and append it to svn_log.txt.

I do not know what your command does but you can try something like that:

svnlook changed %REPOS% -r %REV% > D:\tmp_log.txt


The output of the execution will be put in a file.

Dan06
08-26-2009, 06:29 PM
snvlook cmd returns files that have been modified in the following format:

U dev\trunk\application\test.php

Using
FOR /F "usebackq" %%a IN (`svnlook changed %REPOS% -r %REV%`) DO (svn update %%a & ECHO. %%a >> D:\svn_log.txt)

The svn_log.txt file shows only the "U" - I need the test.php filename instead. How can I get that?

ckeyrouz
08-26-2009, 06:37 PM
simply write this:

svnlook changed %REPOS% -r %REV% >> D:\svn_log.txt


and this will append the output of the file svnlook to the svn_log.txt file.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum