2

I've got the following Perforce command in a bat file:

p4 -c myworkspace sync //path/... 

and I want to re-direct the output to a file. I tried:

p4 -c myworkspace sync //path/... >> file.txt

but the output is show in the command line and doesn't appear in the file. How to solve this?

Is there a parameter I can send to perforce to write the output to a file or can I do this directly from the bat?

Luchian Grigore
  • 253,575
  • 64
  • 457
  • 625

2 Answers2

4

It may be writing to the STDERR stream so this could help.

p4 -c myworkspace sync //path/... >>file.txt 2>&1

>>file.txt will append to file.txt and >file.txt will create a new file every time.

foxidrive
  • 40,353
  • 10
  • 53
  • 68
  • That worked, I saw this solution before but disregarded it because I was certain it didn't write to the error stream - weird it does that. – Luchian Grigore Feb 02 '14 at 20:06
1

foxidrive's answer pertains only to bash.

For (t)csh, STDERR stream redirection is different, use

p4 -c myworkspace sync //path/... >> & file.txt

Refer here for more redirection options.

SDCode
  • 27
  • 7