3
So I have a bunch of locations I need to check for two possible filenames, however the directory names vary.
So here's essentially what I'm trying to optimize:
for /r "%ProgramFiles%\WildGames" %%i in (Uninstall.exe) do ( if exist "%%i" "%%i" /silent ) >nul 2>&1
for /r "%ProgramFiles(x86)%\WildGames" %%i in (Uninstall.exe) do ( if exist "%%i" "%%i" /silent ) >nul 2>&1
for /r "%ProgramFiles%\WildGames" %%i in (Uninstaller.exe) do ( if exist "%%i" "%%i" /silent ) >nul 2>&1
for /r "%ProgramFiles(x86)%\WildGames" %%i in (Uninstaller.exe) do ( if exist "%%i" "%%i" /silent ) >nul 2>&1
Except I need to also check for other locations, not just WildGames. I'm doing the following:
set wtlist1[0]=%ProgramFiles%
set wtlist1[1]=%ProgramFiles(x86)%
set wtlist2[0]=Acer Games
set wtlist2[1]=ASUS Games
set wtlist2[2]=Dell Games
set wtlist2[3]=Gateway Games
set wtlist2[4]=HP Games
set wtlist2[5]=Lenovo Games
set wtlist2[6]=TOSHIBA Games
set wtlist2[7]=WildTangent
set wtlist2[8]=WildTangent Games
set wtlist2[9]=WildGames
set wtlist3[0]=Uninstall.exe
set wtlist3[1]=Uninstaller.exe
Now here's where I'm a bit confused. I know I have to do something -LIKE- this:
for %%a in (wtlist2[0],1,wtlist2[9]) do (
for %%b in (wtlist1[0],1,wtlist1[1]) do (
for %%c in (wtlist3[0],1,wtlist3[1]) do (
echo C:\%%b\%%a\%%c
)
)
)
But obviously not exactly that, and I've basically confused myself up to this point. my array isn't incrementing by 1, but otherwise it looks like this might work?
Thanks!
THANKS SO MUCH! This is perfect! I was quite close in what I was trying by the looks of it, but I didn't fully understand it. – Flux – 2015-12-22T03:50:55.823
@JosefZ I've seen a lot of your advanced batch script stuff and upvoted many of then here on SU and on SE so I wanted to be sure you at least saw this to serve it further justice in case you have some input, gotchas, advanced techniques, etc. which may be related. . . http://superuser.com/questions/1106951/batch-script-redirection-syntax.
– Pimp Juice IT – 2016-08-02T04:37:54.960