help:make log file in Win10

In Windows10, when I execute gmic-cli(gmic-3.1.6-cli-win64) from .bat file, I have a problem to make a log file.
When I execute below a.bat, nothing will be output to log.txt, but infomation is still output to the command-line interface.
What is wrong in this? I would appreciate it if I borrow the forum wisdom.

rem a.bat
"Path"\gmic.exe do something > log.txt
pause

gmic outputs log messages on stderr, not stdout, so you probably have to write:

gmic.exe do something 2> log.txt
2 Likes

Tips:

"Path"\gmic.exe

Add [path]\gmic.exe to the PATH environment variable. Makes it easier to call gmic every time you write a batch file or use CMD.exe or PowerShell directly.

2> log.txt

Add an extra > to make it a continuous log.

1 Like

@David_Tschumperle @afre Thank you for answering!