批处理命令:如果要是包含.PDF [英] Batch command: if IF contains .pdf
问题描述
我试图让批处理文件打印文件夹中的所有PDF文件。
-
我在
LIST.TXT
包含在文件夹中的所有文件(用DIR / X
)。 -
然后我用txt文件中的所有行,找到短文件名中的线(对
/ F令牌= 4...
;例如:12345678.pdf
;LIST.TXT
) 。 -
发送文件进行打印(
AcroRd32.exe/ N / T%1
)和重复#2。
的问题是,它需要的所有行(也未PDF)。是否有任何的可能性如何找到变量的一部分,然后用如果
功能?
事情是这样的:
IF%1==的* .pdf回声打印
您现有的code只需要使用 DIR / X的* .pdf
。
不过,我会像下面这样替换整个code:
为%% f由于(* .PDF)也开始,AcroRd32.exe / N / T%%〜snxF
I am trying to make batch file for printing all PDF files in folder.
I made
list.txt
which contains all files in folder (withdir /x
).Then I use all lines of the txt file and find "short filenames" in line (for
/F "tokens=4" ...
; e.g.12345678.pdf
;list.txt
).Send this file for printing (
AcroRd32.exe" /n /t "%1"
) and repeat #2.
The problem is that it takes all lines (also not PDF). Is any possibilities how to find part of variable and then use IF
function?
Something like this:
IF "%1" == "*.pdf" echo print
Your existing code simply needs to use dir /x *.pdf
.
But I would replace your entire code with something like the following:
for %%F in (*.pdf) do start "" AcroRd32.exe /n /t "%%~snxF"
这篇关于批处理命令:如果要是包含.PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!