I try to create a simple batch file to install Windows CRM. To do it i created 2 arrays which contains URI and name of the downloaded files.
Now, I want to iterate into theses array to download my files. I proceed this way :
setlocal EnableDelayedExpansion
set name=(
SSCERuntime-ENU-x86.msi
SSCERuntime-ENU-x64.msi
msoidcli_64.msi
wllogin_64.msi
ReportViewer.exe
CRM2011-Client-FRA-i386.exe
)
set link=(
"http://go.microsoft.com/fwlink/p/?LinkId=147327"
"http://go.microsoft.com/fwlink/p/?LinkId=147326"
"http://go.microsoft.com/fwlink/p/?LinkId=221500"
"http://go.microsoft.com/fwlink/?LinkId=194722"
"http://go.microsoft.com/fwlink/?LinkId=193386&clcid=0x409"
)
for %%G in %name% do echo %%G = !%%G!
SET i = 1
(for %%a in (%name%) do (
if exist \\srv-dc22\netlogon\CRM\%%G (
echo %%G : Already donwnloaded
)else (
echo Downloading %%G
powershell -command "& { iwr %link[i]% -OutFile %%G }"
SET /A i+=1
)
)
)
But even if i success to get the value for "name" , i do not success to iterate my "link" array.
What's wrong?