繁体   English   中英

如何在批处理文件中使用for循环在文件夹中打开不同数量的图像

[英]How to open varying number of images in folder using for loop in batch file

我有c:\\Images文件夹,并且每天都有不同数量的图像可以使用。 我需要制作一个批处理文件,该文件将在Windows照片查看器中打开所有文件。 这样的for循环(int i=0; i<numberOfItemsInFolder; i++)应该打开WPV numberOfItemsInFolder时间。 我发现这条线开始WPV

%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1

和ofc,此行打开文件夹%SystemRoot%\\explorer.exe "C:\\Image"

只需遍历文件夹:

for %%F in (c:\Images\*.*) do %SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen "%%~fF"

(我不知道此命令如何处理引号,也许您必须将它们从"%%~fF"删除)

如果不是所有图像都应立即打开,请尝试以下操作:

@echo off
for %%F in (c:\Images\*.*) do (
    %SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen "%%~fF"
    echo/any key for next image...&pause>nul
)

〜蒂姆

暂无
暂无

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

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