Command line - bath mode - batch file

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

Moderator: SourceGear

Post Reply
jp1982
Posts: 28
Joined: Fri Aug 27, 2010 3:23 pm

Command line - bath mode - batch file

Post by jp1982 » Tue Oct 05, 2010 4:31 pm

Hello guys! I am working on a app that via command line pulls some files with a specific version. I already did some tests using a batch file which are working perfect. I am just curious if there is a way to specify comments in the batch file. The following is to be able to separate by change number which versions and files it is using. Something like:

#change1
version file
version file

#change2
version file
version file

Thanks for your help! :wink:

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command line - bath mode - batch file

Post by Beth » Tue Oct 05, 2010 4:39 pm

There isn't anything built into our command line to format the output, but you could redirect the output to a file, then parse that file and add in comments I think.
Beth Kieler
SourceGear Technical Support

jp1982
Posts: 28
Joined: Fri Aug 27, 2010 3:23 pm

Re: Command line - bath mode - batch file

Post by jp1982 » Tue Oct 05, 2010 5:59 pm

Beth wrote:There isn't anything built into our command line to format the output, but you could redirect the output to a file, then parse that file and add in comments I think.
Yes.. that is what intend to do. I already tested the batch file containing versions and files just like what I mentioned in the first post.

I guess what I am trying to do is add comments to the batch file used when doing vault.exe BATCH filename but I ignore how to add comments to the batch file. How can I indicate in the batch file that a line is a comment?

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command line - bath mode - batch file

Post by Beth » Wed Oct 06, 2010 7:51 am

You can try starting the line with REM.
Beth Kieler
SourceGear Technical Support

jp1982
Posts: 28
Joined: Fri Aug 27, 2010 3:23 pm

Re: Command line - bath mode - batch file

Post by jp1982 » Wed Oct 06, 2010 11:54 am

Beth wrote:You can try starting the line with REM.
I test that with my batch file. I must mention that at first, the batch file I was using was a simple text (.txt) file so the REM did not work. So I then changed the text file to a .bat and it did not work either.

This is how the contents of the batch file I am using look like. If I get rid of the REM start line, it all works fine either with .txt or .bat

REM start
getversion 3 $/Vault/log4.txt c:/vault
getversion 1 $/Vault/log5.txt c:/vault
getversion 2 $/Vault/log6.txt

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command line - bath mode - batch file

Post by Beth » Wed Oct 06, 2010 12:09 pm

I'm not sure what you mean by it doesn't work. Were you wanting it printed out? A line with REM at the start should be ignored.
Beth Kieler
SourceGear Technical Support

joe_sg
Posts: 27
Joined: Tue Oct 28, 2008 1:20 pm
Location: SourceGear

Re: Command line - bath mode - batch file

Post by joe_sg » Wed Oct 06, 2010 12:56 pm

Oops. Even though we included a BATCH command in the vault command line, our brains immediately switched to MS-DOS mode.

Unfortunately, the file that you pass with "vault BATCH filename" must consist of vault commands, and there is no provision for "comments," or ignored lines. This feature is intended as a convenience for grouping related commands together, but it's not a full-blown scripting function.

Blank lines are ignored, so you can use them to set groups of commands apart from each other, but there's no real way to identify sections using comment lines.
Joe Ream
SourceGear Technical Support

jp1982
Posts: 28
Joined: Fri Aug 27, 2010 3:23 pm

Re: Command line - bath mode - batch file

Post by jp1982 » Wed Oct 06, 2010 1:23 pm

joe_sg wrote:Oops. Even though we included a BATCH command in the vault command line, our brains immediately switched to MS-DOS mode.

Unfortunately, the file that you pass with "vault BATCH filename" must consist of vault commands, and there is no provision for "comments," or ignored lines. This feature is intended as a convenience for grouping related commands together, but it's not a full-blown scripting function.

Blank lines are ignored, so you can use them to set groups of commands apart from each other, but there's no real way to identify sections using comment lines.
Yes that is what I meant, sorry for not expressing my question correctly. Too bad this can't be done. Thanks for your support.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command line - bath mode - batch file

Post by Beth » Thu Oct 07, 2010 9:44 am

I can enter in a feature request if you'd like.
Beth Kieler
SourceGear Technical Support

jp1982
Posts: 28
Joined: Fri Aug 27, 2010 3:23 pm

Re: Command line - bath mode - batch file

Post by jp1982 » Thu Oct 07, 2010 11:42 am

Beth wrote:I can enter in a feature request if you'd like.
I guess someone else might found that helpful. Adding comments in batch files can help you identifying and explaining exactly what you are doing in it.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Command line - bath mode - batch file

Post by Beth » Thu Oct 07, 2010 12:29 pm

I've entered a request. Thank you for bringing this up.

F: 15602
Beth Kieler
SourceGear Technical Support

Post Reply