使用批处理文件打开多个PDF文档
我正在尝试使用简单的批处理文件打开多个 PDF 文档:
ECHO OFF
CLS
cd Program Files\Adobe\Reader 9.0\Reader
Acrord32.exe C:\Users\BW1.pdf
Acrord32.exe C:\Users\BW2.pdf
Acrord32.exe C:\Users\BW3.pdf
Acrord32.exe C:\Users\BW4.pdf
Acrord32.exe C:\Users\BW5.pdf
Acrord32.exe C:\Users\BW6.pdf
EXIT
上面的批处理文件仅打开第一个 PDF,然后等到我关闭它才能打开下一个 PDF 文件。 如何同时打开所有 PDF 文档? (就像进入Acrobat Reader,文件->打开->xx.pdf)
I am trying to open several PDF documents using a simple batch file:
ECHO OFF
CLS
cd Program Files\Adobe\Reader 9.0\Reader
Acrord32.exe C:\Users\BW1.pdf
Acrord32.exe C:\Users\BW2.pdf
Acrord32.exe C:\Users\BW3.pdf
Acrord32.exe C:\Users\BW4.pdf
Acrord32.exe C:\Users\BW5.pdf
Acrord32.exe C:\Users\BW6.pdf
EXIT
The above batch file opens the first PDF only, then waits until I close it for the next PDF file to open. How can I have all the PDF documents open at the same time? (Like going to Acrobat Reader, file->Open->xx.pdf)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
使用
start
:或者甚至(正如 Johannes Rössel 在下面的评论中建议的那样):
也可能有效(取决于您的默认 PDF 查看器)。
请注意,使用
start
时,使用带引号的参数时必须小心,因为以下内容将不起作用(第一个带引号的参数被解释为新控制台窗口的标题):相反,您将必须执行以下操作:
这是
start
的一个恼人的怪癖,但在这种情况下,您必须有效地提供一个虚拟标题才能正确打开指定的文件(即使标题是不必要的,因为这不会创建一个新的控制台窗口)。其他可用批处理命令的列表。
Use
start
:Or even (as Johannes Rössel suggests in the comment below):
Would probably work as well (depending on your default PDF viewer).
Note that when using
start
you have to be careful when using quoted arguments, as the following won't work (the first quoted argument is interpreted as the title for a new console window):Instead you'll have to do the following:
It's an annoying quirk of
start
, but you have to effectively supply a dummy title in this case to properly open the specified file (even though the title is unnecessary as this won't create a new console window).A list of other available batch commands.
对我来说,即使没有
start
命令它也能工作。 我经常在 cmd.exe Windows 中使用:,它总是打开 Acrobat Reader(我在 Windows 上的默认查看器)。 在我编写的通过 Ghostscript 生成 PDF 的批处理文件中,我的最后两行是:
它会自动在两个不同的阅读器窗口中打开生成的 PDF。 (我的
%outputpath%
包含空格,%outputfile%
也可能有一些...)For me it works even without the
start
command. I use:in cmd.exe windows frequently, and it always opens Acrobat Reader (my default viewer on Windows). In a batchfile I've written to generate PDF via Ghostscript, my last two lines are:
which automatically opens both generated PDFs in two different Reader windows. (My
%outputpath%
contains spaces, the%outputfile%
may also have some...)您是否尝试过 Acrobat Reader 是否允许在命令行上显示更多文件,即。
Have you tried whether Acrobat Reader allows for more files on the commandline, ie.
谢谢你!
使用 start 就成功了。 我必须使用 start 的次数与我要打开的 pdf 文档的数量一样多。 由于某种原因
启动 acrord32.exe 1.pdf 2.pdf 3.pdf
仅打开第一个文档。 所以我猜想 Acrobat reader 可能不允许在命令行上输入更多文件。
我非常感谢您的回答。
Thank you!
Using start did the trick. I had to use start as many times as the number of pdf documents I want to open. For some reason
start acrord32.exe 1.pdf 2.pdf 3.pdf
opens only the first document. So I guess Acrobat reader might not allow for more files on the command line.
I rally appreciate your answers.
感谢以上各位的解答。
我也在下面尝试过,工作正常:
start /B excel.exe "D:\我的第一个文件.xlsx" "E:\我的第二个文件.xlsx" "D:\工作文件夹\我的第三个文件.xlsx"
Thanks for the above answers.
I also tried below, working fine:
start /B excel.exe "D:\my first file.xlsx" "E:\my second file.xlsx" "D:\working folder\my third file.xlsx"
对于指定目录中的每个 pdf 文件,请对该文件使用启动命令:
根据 Microsoft 文档:
For every pdf file in the specified directory, use the start command on that file:
As per the Microsoft Docs:
这是对上面 JSON C11 给出的答案的后续。
我检查了 Windows 10 操作系统,此时给出的命令如下并出现错误(“C:\Users*.pdf”)是意外的。
对于 %f ("C:\Users*.pdf") 执行 %f
缺少的是“在”。 正确的代码是...
如果您有一个二进制文件来打开该特定类型的文件,并且您喜欢在最大化视图中打开,则可以使用以下代码。
This is follow up to the answer given by JSON C11 above.
I checked in Windows 10 OS, the command given as below with the error ("C:\Users*.pdf") was unexpected at this time.
for %f ("C:\Users*.pdf") do start %f
What is missing is 'in'. Correct code is...
If you have a binary to open that particular type of file, and you like to open in maximized view, you can use the following code.