1

I am using powershell for running an executable file(caffe.exe). The output is provided by glog, which is written to stderr instead of stdout. So, if I redirect stderr to a log file:

$ARGUMENT_LIST = "train", "--solver=cnn.prototxt"
& caffe.exe "$ARGUMENT_LIST" 2> caffe.log

log file would be like this:

caffe.exe : I0512 15:46:58.838964  1124 caffe.cpp:218] Using GPUs 0
所在位置 D:\caffe\cnn\train_cnn.ps1:13 字符: 1
+ & $BIN_PATH $ARGUMENT_LIST 2>&1 > $LOG_FILE
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (I0512 15:46:58....8] Using GPUs 0:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

I0512 15:46:59.014129  1124 caffe.cpp:223] GPU 0: GeForce GTX 1060
...

I have to remove these additional lines manually. I tried to use $ErrorView = "CategoryView", but still at least one line at the front:

NotSpecified: (I0512 15:55:24....8] Using GPUs 0:String) [], RemoteException

It seems that the first line from stderr has been handled by powershell. Is there any way to stop it?

RangerCD
  • 11
  • 1
  • 1
    http://stackoverflow.com/questions/15437244/how-to-pipe-all-output-of-exe-execution-in-powershell – kai1103 May 12 '17 at 08:48

0 Answers0