简体   繁体   English

通过批处理脚本(.bat)关闭pdf文件

[英]Closing a pdf file via a batch script (.bat)

I use a windows batch file .bat for running latex command to create a pdf. 我使用Windows批处理文件.bat来运行Latex命令来创建pdf。 To open the final pdf file, I wrote 要打开最终的pdf文件,我写道

pdflatex %2
START "" %2.pdf

Where %2 is the filename I passed it as argument. 其中%2是我作为参数传递的文件名。 Problem is, whenever, I run the script, I have to manually close the pdf file and run the script. 问题是,每当我运行脚本时,都必须手动关闭pdf文件并运行脚本。 I want to add a command to first close the opened pdf and then run latex command and then open it 我想添加一个命令以首先关闭打开的pdf,然后运行latex命令,然后将其打开

<CLOSE THE PDF FILE>
pdflatex %2
START "" %2.pdf

I didn't find a CLOSE command in the list of available commands, Information on batch files 我在可用命令列表中未找到CLOSE命令, 有关批处理文件的信息

I highly recommend SS64 for a list of batch commands. 对于批处理命令列表,我强烈建议使用SS64 The command you're looking for is taskkill . 您要查找的命令是taskkill I don't know pdflatex appears in the task manager, but the code is going to be something along the lines of 我不知道pdflatex出现在任务管理器中,但是代码将类似于

taskkill /IM acrord32.exe

Replace acrord32.exe with whatever it appears as in the task manager. 将acrord32.exe替换为任务管理器中显示的内容。 You may also need to add the /F flag before the /IM to force close the program. 您可能还需要在/IM之前添加/F标志,以强制关闭程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM