locked
Need Help with SSARC 6.0d Archive.vbs Script RRS feed

  • Question

  • Need Help with SSARC 6.0d Archive.vbs Script

    I am now the default owner of our development VSS database. It has several top level projects that I want to migrate to their own vss database.  I strongly dislike doing tasks directly from the cmd window so I decided to use a vbscript.

    I found a script to run SSARC daily on MSDN.

    http://msdn.microsoft.com/en-us/library/t9d14fh1(VS.80).aspx

    The script works as written.  I upgraded the script to allow it to use a different variables. Everything was ok as long as only one specific variable included spaces.

    strCMD = "CMD /C " &_
     Chr(34) & SSARCPATH & CHR(34) &_
     SSARC_PARMS & " " &_
     strBAKPath & " " & _
     PROJECT & _
     "  >> " & strLOGPath & " 2>>&1 "
     
    For example:  To allow PROJECT = "Client App", I attempted the following:

    strCMD = "CMD /C " &_
     Chr(34) & SSARCPATH & CHR(34) & _
     SSARC_PARMS & " " & _
     strBAKPath & " " & _
     chr(34) & PROJECT & chr(34) & _
     "  >> " & strLOGPath & " 2>>&1 "

    The resulting error message log was:
    'C:\Program' is not recognized as an internal or external command, operable program or batch file.

    Adding a second set of CHR(34) double quotes appears to create confusion. (Ok, maybe the confusion is mine, but my modified script no longer works.)  If I cut and paste strCMD from the log file, it works when I manually run it from a CMD prompt.  It just doesn't work from the script.

    Ideally, the final state script should accomodate any variable containing a space. 

     Any suggestions would be appreciated.

    Tuesday, May 18, 2010 8:08 PM

Answers

  • JJF,

    From what I can tell, there might be problems when strBakPath or strLOGPath have spaces as you haven't escaped those with double quotes (chr(34)).  Also note, unless SSARCPATH, SSARC_PARMS, and strBakPath have spaces you may have an invalid command as well.

    What you should do is "expand" everything in a text editor, OR try showing strCmd in a message box or perhaps copy it to the clipboard.  From there, you can try string as a command in a prompt to see if it works.


    Jeff Clausius - SourceGear

    Looking to leverage VSS on Windows 7 or VS 2010?  Have a look at SourceOffSite 5 -http://www.sourcegear.com/sos

    Wednesday, May 19, 2010 2:01 PM