Answers.Body: <p>Stockfish is an engine that's called by apps that read PGN files, it doesn't read the PGN data itself. </p>
  
  <p>There are many very good free apps that can read PGN files and analyse the games they contain using Stockfish (which is also free) and/or similar engines (mostly not free)</p>
  
  <p>A lot of good free PGN reader apps that are able to call Stockfish can be downloaded and installed from SourceForge, such as</p>
  
  <p><a href="https://sourceforge.net/projects/chessx/" rel="noreferrer">ChessX</a> An old app but a good one</p>
  
  <p><a href="https://sourceforge.net/projects/scid/" rel="noreferrer">Scid</a> The most popular app on SourceForge at the time of writing</p>
  
  <p><a href="https://sourceforge.net/projects/pgn-chessbook/" rel="noreferrer">PGN ChessBook</a> Which comes with the requested Stockfish engine built in</p>
  
  <p>If you search for "pgn" on SourceForge you should find more apps, but in my opinion these are the best ones currently available.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-21T12:42:04.087Z
Answers.LastActivityDate: 2019-08-21T12:42:04.087Z
Answers.UserDisplayName: Edward Little
Answers.Body: <p>No. Stockfish is an engine not GUI, it doesn't know or understand PGN. The bigger problem is why would you do that? Why would you want to use an engine on a PGN game? This is like giving a calculator your math exam and hope it'll give out answers magically. Please rethink why you would want to do this.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2015-02-02T14:05:27.867Z
Answers.LastActivityDate: 2021-01-31T09:44:12.197Z
Answers.LastEditDate: 2021-01-31T09:44:12.197Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>The answer is NO. The stockfish engine does not have a concept of a chessboard state. Each position should be completely described through FEN notation. If you want to make a move, you then again describe the complete position and append your moves all in one command string then press ENTER on the keyboard. The engine does not remember the current position for you. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-30T12:14:41.853Z
Answers.LastActivityDate: 2015-08-30T12:14:41.853Z
Answers.UserDisplayName: daparic
Answers.Body: <p>You can use 2 programs to do that.</p>
  <ol>
  <li>Use pgn-extract to format the pgn files in a good format. This pgn-extract is available at this url: <a href="https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/" rel="nofollow noreferrer">download pgn-extract</a></li>
  <li>You need this CLI tool: <a href="https://www.cs.kent.ac.uk/people/staff/djb/uci-analyser/" rel="nofollow noreferrer">UCI analyzer</a></li>
  <li>Lastly, you need a chess engine that supports UCI installed, such as Stockfish.</li>
  </ol>
  <p>I used these tools to perform a massive analysis of 2 million games on multiple machines.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-09T04:00:48.807Z
Answers.Text: Thank you for this Olivier!
Answers.UserDisplayName: hangejj
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-28T20:53:43.220Z
Answers.LastActivityDate: 2021-04-29T07:47:51.583Z
Answers.LastEditDate: 2021-04-29T07:47:51.583Z
Answers.UserDisplayName: Olivier Roset
Body: <p>Is there a way to read a PGN file using the Stockfish engine? If so, please give a sample command.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-02T14:58:16.350Z
Comments.Text: http://chess.stackexchange.com/questions/4099/how-do-engines-read-pgn?rq=1
Comments.UserDisplayName: BlindKungFuMaster
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-02T14:59:13.107Z
Comments.Text: Especially the second answer probably answers your question as well.
Comments.UserDisplayName: BlindKungFuMaster
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-09T17:28:15.673Z
Comments.Text: either you want to a) make stockfish start from a position in a pgn file b) make stockfish analyze a game from pgn file (you can do both with sw like arena or chessbase).
Comments.UserDisplayName: Fernando Gonzalez Sanchez
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-30T04:07:50.873Z
Comments.Text: Looks like we have some necromancy here, but if you're on Windows one good answer is to run SCID + Stockfish. SCID handles the input for you.
Comments.UserDisplayName: Tony Ennis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-18T05:27:08.750Z
Comments.Text: I would recommend Arena Chess http://playwitharena.com By far, The best GUI I have come across to this day...
Comments.UserDisplayName: cascading-style
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-07T17:04:20.930Z
Comments.Text: Here is how SF parses position command: https://github.com/official-stockfish/Stockfish/blob/master/src/uci.cpp#L51
Comments.UserDisplayName: Nikolay Kostov
Tags: <analysis><pgn><stockfish><uci>
Title: Reading PGN files using thr Stockfish engine
ThreadText: # Reading PGN files using thr Stockfish engine
  
  (Asked by: username_0 on 2015-02-02)
  
  Is there a way to read a PGN file using the Stockfish engine? If so, please give a sample command.
  
  **Tags:** analysis, pgn, stockfish, uci
  
  > **Comments:**
  > **username_1**: http://chess.stackexchange.com/questions/4099/how-do-engines-read-pgn?rq=1  
  > **username_1**: Especially the second answer probably answers your question as well.  
  > **username_2**: either you want to a) make stockfish start from a position in a pgn file b) make stockfish analyze a game from pgn file (you can do both with sw like arena or chessbase).  
  > **username_3**: Looks like we have some necromancy here, but if you're on Windows one good answer is to run SCID + Stockfish. SCID handles the input for you.  
  > **username_4**: I would recommend Arena Chess http://playwitharena.com By far, The best GUI I have come across to this day...  
  > **username_5**: Here is how SF parses position command: https://github.com/official-stockfish/Stockfish/blob/master/src/uci.cpp#L51  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_6 on 2019-08-21. Score: 6
  
  Stockfish is an engine that's called by apps that read PGN files, it doesn't read the PGN data itself.
  
  There are many very good free apps that can read PGN files and analyse the games they contain using Stockfish (which is also free) and/or similar engines (mostly not free)
  
  A lot of good free PGN reader apps that are able to call Stockfish can be downloaded and installed from SourceForge, such as
  
  [ChessX](https://sourceforge.net/projects/chessx/) An old app but a good one
  
  [Scid](https://sourceforge.net/projects/scid/) The most popular app on SourceForge at the time of writing
  
  [PGN ChessBook](https://sourceforge.net/projects/pgn-chessbook/) Which comes with the requested Stockfish engine built in
  
  If you search for "pgn" on SourceForge you should find more apps, but in my opinion these are the best ones currently available.
  
  
  ---
  
  ### Answer by username_7 on 2015-02-02. Score: 5
  
  No. Stockfish is an engine not GUI, it doesn't know or understand PGN. The bigger problem is why would you do that? Why would you want to use an engine on a PGN game? This is like giving a calculator your math exam and hope it'll give out answers magically. Please rethink why you would want to do this.
  
  
  ---
  
  ### Answer by username_8 on 2015-08-30. Score: 5
  
  The answer is NO. The stockfish engine does not have a concept of a chessboard state. Each position should be completely described through FEN notation. If you want to make a move, you then again describe the complete position and append your moves all in one command string then press ENTER on the keyboard. The engine does not remember the current position for you.
  
  
  ---
  
  ### Answer by username_9 on 2021-04-28. Score: 3
  
  You can use 2 programs to do that.
  
  1. Use pgn-extract to format the pgn files in a good format. This pgn-extract is available at this url: [download pgn-extract](https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/)
  2. You need this CLI tool: [UCI analyzer](https://www.cs.kent.ac.uk/people/staff/djb/uci-analyser/)
  3. Lastly, you need a chess engine that supports UCI installed, such as Stockfish.
  
  I used these tools to perform a massive analysis of 2 million games on multiple machines.
  
  > **Comments:**
  > **username_10**: Thank you for this Olivier!  
  
  ---
  
  