I am trying to open several PDF documents using a simple batch file:
我试图使用一个简单的批处理文件打开几个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
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)
上面的批处理文件只打开第一个PDF,然后等到我关闭它以打开下一个PDF文件。如何同时打开所有PDF文档? (比如去Acrobat Reader,文件 - > Open-> xx.pdf)
6 个解决方案
#1
Use start
:
start acrord32.exe 1.pdf
start acrord32.exe 2.pdf
start acrord32.exe 3.pdf
Or even (as Johannes Rössel suggests in the comment below):
甚至(正如JohannesRössel在下面的评论中所建议的那样):
start 1.pdf
start 2.pdf
start 3.pdf
Would probably work as well (depending on your default PDF viewer).
可能也会起作用(取决于您的默认PDF查看器)。
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):
请注意,使用start时,在使用带引号的参数时必须小心,因为以下内容不起作用(第一个引用的参数被解释为新控制台窗口的标题):
start "1.pdf"
Instead you'll have to do the following:
相反,你必须做以下事情:
start "" "1.pdf"
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.
其他可用批处理命令的列表。
#2
For me it works even without the start
command. I use:
对我来说,即使没有启动命令也可以。我用:
c:\path\to\my.pdf
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:
经常在cmd.exe窗口中,它始终打开Acrobat Reader(Windows上的默认查看器)。在我编写的批处理文件中,通过Ghostscript生成PDF,我的最后两行是:
"%ouptutpath%\%outputfile%.pdf"
"%outputpath%\%outputfile%-optimized.pdf"
which automatically opens both generated PDFs in two different Reader windows. (My %outputpath%
contains spaces, the %outputfile%
may also have some...)
它会在两个不同的Reader窗口中自动打开两个生成的PDF。 (我的%outputpath%包含空格,%outputfile%也可能有一些...)
#3
Have you tried whether Acrobat Reader allows for more files on the commandline, ie.
您是否尝试过Acrobat Reader是否允许在命令行上添加更多文件,即。
start acrord32.exe 1.pdf 2.pdf 3.pdf
#4
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就可以了。我必须使用start作为我想要打开的pdf文档的数量。由于某些原因
start acrord32.exe 1.pdf 2.pdf 3.pdf
启动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.
仅打开第一个文档。所以我猜Acrobat reader可能不允许在命令行上添加更多文件。
I rally appreciate your answers.
我赞赏你的回答。
#5
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"
start / B excel.exe“D:\ my first file.xlsx”“E:\ my second file.xlsx”“D:\ working folder \ my third file.xlsx”
#6
For every pdf file in the specified directory, use the start command on that file:
对于指定目录中的每个pdf文件,请对该文件使用start命令:
for %f ("C:\Users\*.pdf") do start %f
As per the Microsoft Docs:
根据Microsoft Docs:
For runs a specified command for each file in a set of files.
用于为一组文件中的每个文件运行指定的命令。
for {%variable|%%variable} in (set) do command [ CommandLineOptions]
对于(set)do {commandLineOptions]中的{%variable | %% variable}
#1
Use start
:
start acrord32.exe 1.pdf
start acrord32.exe 2.pdf
start acrord32.exe 3.pdf
Or even (as Johannes Rössel suggests in the comment below):
甚至(正如JohannesRössel在下面的评论中所建议的那样):
start 1.pdf
start 2.pdf
start 3.pdf
Would probably work as well (depending on your default PDF viewer).
可能也会起作用(取决于您的默认PDF查看器)。
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):
请注意,使用start时,在使用带引号的参数时必须小心,因为以下内容不起作用(第一个引用的参数被解释为新控制台窗口的标题):
start "1.pdf"
Instead you'll have to do the following:
相反,你必须做以下事情:
start "" "1.pdf"
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.
其他可用批处理命令的列表。
#2
For me it works even without the start
command. I use:
对我来说,即使没有启动命令也可以。我用:
c:\path\to\my.pdf
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:
经常在cmd.exe窗口中,它始终打开Acrobat Reader(Windows上的默认查看器)。在我编写的批处理文件中,通过Ghostscript生成PDF,我的最后两行是:
"%ouptutpath%\%outputfile%.pdf"
"%outputpath%\%outputfile%-optimized.pdf"
which automatically opens both generated PDFs in two different Reader windows. (My %outputpath%
contains spaces, the %outputfile%
may also have some...)
它会在两个不同的Reader窗口中自动打开两个生成的PDF。 (我的%outputpath%包含空格,%outputfile%也可能有一些...)
#3
Have you tried whether Acrobat Reader allows for more files on the commandline, ie.
您是否尝试过Acrobat Reader是否允许在命令行上添加更多文件,即。
start acrord32.exe 1.pdf 2.pdf 3.pdf
#4
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就可以了。我必须使用start作为我想要打开的pdf文档的数量。由于某些原因
start acrord32.exe 1.pdf 2.pdf 3.pdf
启动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.
仅打开第一个文档。所以我猜Acrobat reader可能不允许在命令行上添加更多文件。
I rally appreciate your answers.
我赞赏你的回答。
#5
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"
start / B excel.exe“D:\ my first file.xlsx”“E:\ my second file.xlsx”“D:\ working folder \ my third file.xlsx”
#6
For every pdf file in the specified directory, use the start command on that file:
对于指定目录中的每个pdf文件,请对该文件使用start命令:
for %f ("C:\Users\*.pdf") do start %f
As per the Microsoft Docs:
根据Microsoft Docs:
For runs a specified command for each file in a set of files.
用于为一组文件中的每个文件运行指定的命令。
for {%variable|%%variable} in (set) do command [ CommandLineOptions]
对于(set)do {commandLineOptions]中的{%variable | %% variable}