4

I can get this to work in a Windows Command Prompt window as follows:

stockfish_14_x64_modern.exe
uci
ucinewgame
position fen rnb1kbnr/ppp1pppp/8/3q4/8/8/PPPP1PPP/RNBQKBNR w KQkq - 0 1
go depth 17
quit

If I put this into batch file and pipe the output to a log file, the log file contains output up to and including the uciok line. Note that the batch file is a single, long line. The parameters are not one-per-line.

Screen Shot

4
  • Do you want the batch file syntax for accomplishing the same. Or do you want to fix the formatting of shown in pic. I have done my first SF command line run. and copied from a such a command windows. pasted to editor. It shows that the text has CRLF corresponding to the default windows command windows. You should repeat your exact question as the risk of redundancy. I give a UCI answer below, that could fix the CRLR. UCI makes the process dialogue based. so your batch file should be able to do the same as "expect" in bash (see test folder).
    – dbdb
    Aug 8, 2021 at 22:39
  • 1
    I want the batch file syntax - I don't care about the formatting. I want to get the lines starting with "info" to appear in an output file. My current batch file looks like this: <br/> stockfish_14_x64_modern uci ucinewgame position fen rnb1kbnr/ppp1pppp/8/3q4/8/8/PPPP1PPP/RNBQKBNR w KQkq - 0 1 go depth 17 quit <br/> I run the batch file in a command line window this way: sfAnalyze.bat > sfAnalyze.log Aug 11, 2021 at 19:07
  • 1
    I want the batch file syntax - I don't care about the formatting. @dbdb Aug 11, 2021 at 19:13
  • See in my answer below for more of my comments, and maybe a solution to your real question as above last comment. Why not put it in the main question? @Hal Heinrich
    – dbdb
    Aug 15, 2021 at 7:08

1 Answer 1

1

Assuming the question is about fixing the width formatting of the windows command window when copying text directly from that:

Have you tried : uci .... then when ready.

setoption name Debug Log File type string default

All subsequent commands should be executed, echoed in command window and the output file, as well as all output from SF.

It actually works, and I verified that the CRLF correspond to each SF output lines, not those of the DOS window maximal width.

"type string default"? need to carefully read the UCI protocol, excerpted here:

  • setoption name [value ] this is sent to the engine when the user wants to change the internal parameters of the engine. For the "button" type no value is needed. One string will be sent for each parameter and this will only be sent when the engine is waiting. The name of the option in should not be case sensitive and can include spaces like also the value. The substring "value" and "name" should be avoided in and to allow unambiguous parsing, for example do not use = "draw value".

In other words, after deduction and testing, write without the quotes (there to emphasize what is required in using the uci definition above)

"Setoption name Debug Log File" "value" YouroutputFilepath

YouroutputFilepath = typical windows path including filename. or just a file name for a file in your Stockfish executable folder.

5
  • As per your suggestion, I modified my batch file to: <br/>stockfish_14_x64_modern uci setoption name Debug Log File type string default setoption name Debug Log File value E:\Chess\Stockfish\sfAnalyzeSx.log ucinewgame position fen rnb1kbnr/ppp1pppp/8/3q4/8/8/PPPP1PPP/RNBQKBNR w KQkq - 0 1 go depth 17 quit </br> The "info" lines still don't appear in the output text file. @dbdb Aug 11, 2021 at 19:14
  • Did you first try the batch file commands interactively?
    – dbdb
    Aug 15, 2021 at 6:40
  • you don't need this extra command that you wrote in you batch file. It may actually prevent the following one to work (bug i know to be under fixing, where you can't redefine a new output file). setoption name Debug Log File type string default also, for simplicity if you don't mind the output file in same folder as executable, you don't need the full path. Now, did any batch file ever work with only the uci command, and the debug log file command followed by another uci. I can do it interactively.
    – dbdb
    Aug 15, 2021 at 6:48
  • Now if you did check interactively first. Then I think, you have to find the windows batch command that translates the unix bash command named "expect" (some kind of eol). You could also ,instead of using windows batch file, install git for windows (or MSYS2 or any unix tool for windows). That comes with own bash shell. And you could edit down the .... \sf_14_src\tests\reprosearch.sh" in your stockfish folder, to just have a uci command and one of those "expect" lines that allow the batch file to act like a dialog environment. because that is what SF expects.
    – dbdb
    Aug 15, 2021 at 6:57
  • I am sorry, i have not tried that myself. But I did run one of those bash shell batch file on my windows, as they are. and the git bash has no problem. I think what you miss is that dialogue part. otherwise the batch file does nothing after calling SF and perhaps the uci... is my understanding. I don't know the equivalent in DOS or Windows. But I am confident that this is the nature of the problem. not the external > to redirect output in windows. not even the internal UCI debug log file (that fixes the formatting as bonus, but not your question as rephrased in comments to the question)
    – dbdb
    Aug 15, 2021 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.