【发布时间】:2017-05-14 12:07:38
【问题描述】:
我的脚本中的问题是索引目录文件时的返回值。 首先,我需要循环我的数组,其次是在目录中查找文件。返回值仍然没有变化,并显示所有变量中的最新值。 是的,我知道,这可能是因为我使用 setx 但仅使用 set 绝对不能正常工作。
for /L %%G in (1,1,%i%) do (
if NOT {arch}=={32} (
setx DriverPath !DefaultPath!driver\!DriverPath64[%%G]! >nul 2>&1
) else (
setx DriverPath !DefaultPath!driver\!DriverPath32[%%G]! >nul 2>&1
)
:: looking for inf file
for /r "%DriverPath%\" %%f in (*.inf) do (
set PrinterDriverInf[%%G]=%%f
)
)
【问题讨论】:
-
你的意思是
if NOT语句中的%arch%吗?(字符串arch不等于字符串32)你是否添加了setlocal enableDelayedExpansion before thefor`循环?
标签: windows batch-file for-loop nested-loops