Answers.Body: <p>Assuming the question is about fixing the width formatting of the windows command window when copying text directly from that:</p>
  <p>Have you tried :
  uci
  ....
  then when ready.</p>
  <p><strong>setoption name Debug Log File type string default</strong></p>
  <p>All subsequent commands should be executed, echoed in command window and the output file, as well as all output from SF.</p>
  <p>It actually works, and I verified that the CRLF correspond to each SF output lines, not those of the DOS window maximal width.</p>
  <p>&quot;type string default&quot;?
  need to carefully read the UCI protocol, excerpted here:</p>
  <ul>
  <li>setoption name  [value ]
  this is sent to the engine when the user wants to change the internal parameters    of the engine. <strong>For the &quot;button&quot; type no value is needed</strong>.    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 &quot;<strong>value</strong>&quot; and &quot;<strong>name</strong>&quot; should be avoided in  and  to allow unambiguous parsing,
  for example do not use  = &quot;draw value&quot;.</li>
  </ul>
  <p>In other words, after deduction and testing, write without the quotes (there to emphasize what is required in using the uci definition above)</p>
  <p><strong>&quot;Setoption name Debug Log File&quot; &quot;value&quot; YouroutputFilepath</strong></p>
  <p>YouroutputFilepath = typical windows path including filename.
  or just a file name for a file in your Stockfish executable folder.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-11T19:14:56.100Z
Answers.Text: 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
Answers.UserDisplayName: Hal Heinrich
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-15T06:40:01.647Z
Answers.Text: Did you first try the batch file commands interactively?
Answers.UserDisplayName: dbdb
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-15T06:48:26.303Z
Answers.Text: 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.
Answers.UserDisplayName: dbdb
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-15T06:57:04.667Z
Answers.Text: 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.
Answers.UserDisplayName: dbdb
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-15T07:11:08.043Z
Answers.Text: 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)
Answers.UserDisplayName: dbdb
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-08T22:39:25.137Z
Answers.LastActivityDate: 2021-08-08T23:18:13.697Z
Answers.LastEditDate: 2021-08-08T23:18:13.697Z
Answers.UserDisplayName: dbdb
Body: <p>I can get this to work in a Windows Command Prompt window as follows:</p>
  <p><em><strong>stockfish_14_x64_modern.exe <br/>
  uci <br/>
  ucinewgame <br/>
  position fen rnb1kbnr/ppp1pppp/8/3q4/8/8/PPPP1PPP/RNBQKBNR w KQkq - 0 1 <br/>
  go depth 17 <br/>
  quit <br/></strong></em></p>
  <p>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 <em><strong>uciok</strong></em> line. Note that the batch file is a single, long line. The parameters are not one-per-line.</p>
  <p><a href="https://i.sstatic.net/S6BTa.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/S6BTa.png" alt="Screen Shot" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-08T22:39:03.307Z
Comments.Text: 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).
Comments.UserDisplayName: dbdb
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-11T19:07:09.600Z
Comments.Text: 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
Comments.UserDisplayName: Hal Heinrich
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-11T19:13:56.770Z
Comments.Text: I want the batch file syntax - I don't care about the formatting.  @dbdb
Comments.UserDisplayName: Hal Heinrich
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-08-15T07:08:23.167Z
Comments.Text: 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
Comments.UserDisplayName: dbdb
Tags: <engines><analysis><stockfish><computer-chess><windows>
Title: How do I get Stockfish to write its analysis to a file using a batch file on Windows?
ThreadText: # How do I get Stockfish to write its analysis to a file using a batch file on Windows?
  
  (Asked by: username_0 on 2021-07-11)
  
  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](https://i.sstatic.net/S6BTa.png)](https://i.sstatic.net/S6BTa.png)
  
  **Tags:** engines, analysis, stockfish, computer-chess, windows
  
  > **Comments:**
  > **username_1**: 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).  
  > **username_0**: 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  
  > **username_0**: I want the batch file syntax - I don't care about the formatting.  @username_1  
  > **username_1**: 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? @username_0  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-08-08. Score: 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.
  
  > **Comments:**
  > **username_0**: 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. @username_1  
  > **username_1**: Did you first try the batch file commands interactively?  
  > **username_1**: 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.  
  > **username_1**: 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.  
  > **username_1**: 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)  
  
  ---
  
  