Batch file 批处理文件以打开文件夹中X个文件
我正在写一个批处理文件 在批处理文件的中间,我想让它在文件夹中打开2个文件。不管是哪一个。。可能是前两个,最后两个,随便什么。我这样做是为了让我们的用户可以通过更长的批处理文件过程来检查书中的一些图像。我想这样做:Batch file 批处理文件以打开文件夹中X个文件,batch-file,for-loop,Batch File,For Loop,我正在写一个批处理文件 在批处理文件的中间,我想让它在文件夹中打开2个文件。不管是哪一个。。可能是前两个,最后两个,随便什么。我这样做是为了让我们的用户可以通过更长的批处理文件过程来检查书中的一些图像。我想这样做: set book=12345 for /F in ('\\server\share\%book%\*.pdf') DO ( open the first PDF file in the folder ) Repeat one time 谢谢您的时间。您可以跟踪迭代次数,并在达到极限
set book=12345
for /F in ('\\server\share\%book%\*.pdf') DO (
open the first PDF file in the folder
)
Repeat one time
谢谢您的时间。您可以跟踪迭代次数,并在达到极限时退出循环
:: Enable delayedexpansion so we can use variables in the for loop
setlocal enabledelayedexpansion
set book=12345
set count=0
for %%F in (*.pdf) DO (
REM - open the PDF file here
:: Increment count (/a does arithmetic addition)
set /a count=!count!+1
:: Exit loop if count is 2
if !count! == 2 goto after
)
:after
好极了非常感谢你。