batch file - I need a windows command line script that takes an output, edits it and creates an environmental variable -
i have asset tags embedded in bios. use
wmic systemenclosure smbiosassettag
this pulls information want not formatted well:
smbiosassettag
11886
i need have 5 numbers , nothing else. use variable name computer first logon script. have spent hours on this, , have been done in 3 minutes if linux.
note: can't put linux tools on these builds :-(
using
wmic systemenclosure smbiosassettag /format:value
will make better output:
(some empty lines) smbiosassettag=czc1296fld (some empty lines)
so, in batch may just
for /f "tokens=1,* delims==" %%v in (wmic systemenclosure smbiosassettag /format:value) if /i "%%v" == "smbiosassettag" set smbiosassettag=%%w
side note: hard part in wmic output handling empty lines.
Comments
Post a Comment