Redirect Output

If you are having a problem using SourceOffSite, post a message here.

Moderator: SourceGear

Post Reply
gotdablues
Posts: 15
Joined: Thu Nov 03, 2005 8:51 pm

Redirect Output

Post by gotdablues » Wed Nov 09, 2005 3:10 pm

How do can I redirect the output of soscmd to a log file?

In VSS, you can do something like "ss ... -olog.txt". The output is written to a file named log.txt.

Thanks.

Steve

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Thu Nov 10, 2005 9:29 am

You can redirect output to a text file by using ">."

For instance, on my machine:

Code: Select all

soscmd -command getdatabases -server myserver:8080 > C:\_sos\clcfile.txt
will create a file named clcfile.txt with contents from the output:

C:\Program Files\Microsoft Visual Studio\Common\VSS\srcsafe.ini
C:\VSS Databases\_test\srcsafe.ini
C:\VSS Databases\MyDB\srcsafe.ini
Linda Bauer
SourceGear
Technical Support Manager

gotdablues
Posts: 15
Joined: Thu Nov 03, 2005 8:51 pm

Post by gotdablues » Thu Nov 10, 2005 9:43 am

Linda,

I have an automated script that labels, extracts, etc. from VSS. When I execute the soscmd through cscript, the redirection does not work.

Example.

Dim WSHShell
Dim cmd
Dim JobStatus

Set WshShell = WScript.CreateObject("WScript.Shell")


cmd = "soscmd -command GetProject " & SOS_CONNECTIONSTRING & " -project """ & SSafeProj & """ -label "& AssemblyVersion & " > """ & LatestBuild & "\SSafeOut_Get.txt"""
WScript.Echo cmd
JobStatus = WSHShell.Run (cmd, 1, true)
WScript.Echo "rc=" & JobStatus & vbCRLF

The command does execute but the redirection does not work.

Thoughts?

Steve

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Thu Nov 10, 2005 4:54 pm

We don't see anything glaringly wrong . . . I assume all your variables are correct? Is the file created, but it's empty? Or is there no file?

Does it make a difference if you explicitly specify the path to the file?
What if you redirect the output of Cscript, rather than the CLC?
Linda Bauer
SourceGear
Technical Support Manager

Post Reply