Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2008
    Posts
    205
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Batch file - storing results of exe command

    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.

    Code:
    @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)

  • #2
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    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:
    Code:
    svnlook changed %REPOS% -r %REV% > D:\tmp_log.txt
    The output of the execution will be put in a file.

  • #3
    Regular Coder
    Join Date
    Sep 2008
    Posts
    205
    Thanks
    1
    Thanked 0 Times in 0 Posts
    snvlook cmd returns files that have been modified in the following format:
    U dev\trunk\application\test.php
    Using
    Code:
    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?
    Last edited by Dan06; 08-26-2009 at 07:37 PM.

  • #4
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    simply write this:
    Code:
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •