In the batch file:
for /f "tokens=1,2 delims= " %%a in (foo.csv) do ( wdsutil /Set-Device /Device:%%a /ID:%%b )
Actually, you can do this as a single line from cmd
directly:
for /f "tokens=1,2 delims= " %a in (foo.csv) do wdsutil /Set-Device /Device:%a /ID:%b
In PowerShell, you can use a similar idea:
Get-Content foo.csv | ForEach-Object { $name,$mac = -split $_ wdsutil /Set-Device /Device:$name /ID:$mac }
Or use the CSV import cmdlet, but considering your question, you have no column headers, so you need to provide them manually:
Import-CSV -Delim ' ' -Path foo.csv -Header Name,Mac | ForEach-Object { wdsutil /Set-Device "/Device:$($_.Name)" "/ID:$($_.Mac)" }
source share