[Tex/LaTex] latexmk not working after MiKTeX update

latexmkmiktex

I am using MiKTeX/TeXworks and set latexmk up years ago. It's been working well until yesterday when I updated MiKTeX.

The typesetting routine for latexmk that I use is:

enter image description here

However, now when I try to compile using my latexmk processing option I obtain the following log file:

Latexmk: This is Latexmk, John Collins, 18 June 2019, version: 4.65.
Rule 'pdflatex': The following rules & subrules became out-of-date:
    'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -synctex=1  -recorder  "DOCUMENT.tex"'
------------
Latexmk: applying rule 'pdflatex'...
Can't spawn "pdflatex -synctex=1  -recorder  "DOCUMENT.tex"": Inappropriate I/O control operation at C:\Program Files\MiKTeX 2.9\scripts/latexmk\latexmk.pl line 9732.
Latexmk: fls file doesn't appear to have been made.
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 255
    Refer to 'DOCUMENT.log' for details
----------------------
This message may duplicate earlier message.
Latexmk: Failure in processing file 'DOCUMENT.tex':
(Pdf)LaTeX didn't generate the expected log file 'DOCUMENT.log'
----------------------
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs, or warnings treated as errors.
Latexmk: Errors, so I did not complete making targets

I've tried searching for what to do, but haven't found anything too useful so far. Can anyone provide some guidance? Everything compiles as it should if I manually do pdflatex + bibtex + pdflatex + pdflatex.

The TeXworks version is Version 0.6.3 (MiKTeX 2.9.7140 64-bit).

Edit: Here's what I get from running latexmk from the command line. An error message

enter image description here

and the output

C:\Users\username\folder>latexmk
Latexmk: This is Latexmk, John Collins, 18 June 2019, version: 4.65.
Latexmk: Disallowing switch of output file as incompatible
    with file requests.
Latexmk: applying rule 'latex'...
Rule 'latex': The following rules & subrules became out-of-date:
      'latex'
------------
Run number 1 of rule 'latex'
------------
------------
Running 'latex  -recorder  "DOCUMENT.tex"'
------------
Can't spawn "latex  -recorder  "DOCUMENT.tex"": Inappropriate I/O control operati
on at C:\Program Files\MiKTeX 2.9\scripts/latexmk\latexmk.pl line 9732.
Latexmk: fls file doesn't appear to have been made.
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  latex: Command for 'latex' gave return code 255
      Refer to 'DOCUMENT.log' for details
----------------------
This message may duplicate earlier message.
Latexmk: Failure in processing file 'DOCUMENT.tex':
   (Pdf)LaTeX didn't generate the expected log file 'DOCUMENT.log'
----------------------
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.

Best Answer

A lot of the exe-files in the miktex bin folder are very small: they are simply wrappers. The "real" application code is in some dll (and/or some script), and the wrappers must find the "entry point". Sometimes after an update the entry point changed and the wrappers must be recreated. Normally miktex takes care of this, but it can fail for whatever reason. In this case the wrappers can be recreated with

  initexmf --mklinks --admin --force

or if only scripts like latexmk are affected

  initexmf --mklinks=scripts --admin --force

See also https://docs.miktex.org/2.9/manual/initexmf.html