当我在 Windows 命令提示符下调用时miktexsetup.exe
,它的行为符合预期并成功。但如果我将其放入批处理脚本中,它会失败并输出
installed 3706 package manifests
visiting repository \\fra-app-216\miktex...
repository type: local package repository
loading package repository manifest...
MiKTeX encountered an internal error.
Info:
Source: Libraries\MiKTeX\Core\Session\config.cpp
Line: 577
Sorry, but "MiKTeX Configuration Utility" did not succeed.
initexmf: MiKTeX encountered an internal error.
执行的命令是\\server\miktex\miktexsetup.exe --verbose --trace --local-package-repository=\\server\miktex --modify-path=yes --package-set=essential --shared=no --use-registry=yes --user-roots="<LOCALAPPDATA>\texmf" install
这里出了什么问题?
调试详细信息
我尝试使用接收消息的 DebugView 实用程序--trace
进一步调查,但未能理解问题的原因。失败尝试的最后一个日志输出是:
[miktexsetup.setup]: Installation: C:\Users\user\AppData\Local\Programs\MiKTeX 2.9
[miktexsetup.setup]: initexmf "--user-install=C:\Users\user\AppData\Local\Programs\MiKTeX 2.9" --set-config-value=[Core]SharedSetup=0 --user-roots=<LOCALAPPDATA>\texmf "--log-file=C:\Users\user\AppData\Local\Programs\MiKTeX 2.9\miktex/config\uninst.log" --disable-installer --verbose:
[miktexsetup.core]: redirecting stdout to a pipe
[miktexsetup.core]: make child stderr = child stdout
[miktexsetup.core]: setting env MIKTEX_GS_LIB=C:\Program Files\MiKTeX 2.9\ghostscript\base;C:\Users\user\AppData\Local\Programs\MiKTeX 2.9\ghostscript\base;C:\Program Files\MiKTeX 2.9\fonts;C:\Users\user\AppData\Local\Programs\MiKTeX 2.9\fonts
[miktexsetup.core]: setting env MIKTEX_CWDLIST=
[miktexsetup.core]: start process: initexmf "--user-install=C:\Users\user\AppData\Local\Programs\MiKTeX 2.9" --set-config-value=[Core]SharedSetup=0 --user-roots=<LOCALAPPDATA>\texmf "--log-file=C:\Users\user\AppData\Local\Programs\MiKTeX 2.9\miktex/config\uninst.log" --disable-installer --verbose
[miktexsetup.core]: setting env MIKTEX_EXCEPTION_PATH=C:\Users\user\AppData\Local\Temp\mik6A21.tmp
[miktexsetup.core]: start reading the pipe
[miktexsetup.core]: read 170 bytes from the pipe
[miktexsetup.core]: parsing: C:\Users\user\AppData\Local\Temp\mik6A21.tmp...
[miktexsetup.core]: setting env MIKTEX_EXCEPTION_PATH=
成功的尝试显示了一次initexmf
呼叫并从管道读取了 76 个字节:
[miktexsetup.core]: setting env MIKTEX_EXCEPTION_PATH=C:\Users\user\AppData\Local\Temp\mikA665.tmp
[miktexsetup.core]: start reading the pipe
INFO initexmf - starting: MiKTeX Configuration Utility 2.9.7251 (MiKTeX 2.9.7250 64-bit)
INFO initexmf - Operating on the private (per-user) MiKTeX setup
INFO initexmf - starting with command line: initexmf "--user-install=C:\Users\user\AppData\Local\Programs\MiKTeX 2.9" --set-config-value=[Core]SharedSetup=0 --user-roots=<LOCALAPPDATA>\texmf "--log-file=C:\Users\user\AppData\Local\Programs\MiKTeX 2.9\miktex/config\uninst.log" --disable-installer --verbose
INFO initexmf - Registering root directories...
INFO initexmf - Setting config value: [Core]SharedSetup=0
INFO initexmf - finishing with exit code 0
[miktexsetup.core]: read 76 bytes from the pipe
并继续安装。
答案1
不确定是否仍然是同样的问题,但今天更新存储库(拉取了 MiKTeXsetup 2.9.7000 MiKTeX 2.9.7250)后,错误消息变为:
Configuration error: cannot convert '--verbose' to boolean.
Info: s="--verbose"
Source: Libraries\MiKTeX\Core\Session\config.cpp
Line: 574
这非常有用。删除该选项--verbose
即可解决问题。不再出现错误。