Multiple File batch variable is offset

101 Views Asked by At

So I am trying to write a script to check remote machines to see if they have specific updates. It works when there is 1 entry in variable. However, It would be much better if I could check multiple variables and return a result for each variable. for example: a=x , b=y, c=w check for x & print result; check for y & print, check for w & print. also, don't know why but it seems to offset every variable name by 1 20h2=0h2, except derp.

set "20h2=KB4562830"
set "1809=KB1234567"
set "20H2-SEC=KB2456789"
set "DERP=Four"

set ^"RECENTS=%20h2%^

%1809%^

%20h2-sec%^

%DERP%^"



echo ++Looking for !RECENTS!

psexec -accepteula \\%COMPUTER% cmd /c powershell.exe -command "& {get-hotfix -computername localhost  | select InstalledOn,HotFixID,Description | Sort-Object -Descending -Property InstalledOn -ErrorAction SilentlyContinue |findstr !RECENTS!}
""
0

There are 0 best solutions below