1
I'm not really versed in batch file, but I am trying to get the workgroup using wmic
. I've been trying different things with the for
options. So far this is the best result I have gotten.
for /f "skip=1" %%a in ('wmic computersystem get workgroup') do echo %%a
This returns what I want, but it is also echoing something else because it gives an echo is off
message. I also want to set the workgroup to a variable such as something like this.
for /f "skip=1" %%a in ('wmic computersystem get workgroup') do set "myVar=%%a"
This doesn't return anything though. I'm assuming I need to use tokens
and/or delims
, but I just don't have the knowledge to get it to work correctly.
If anyone could assist me on this I would be much appreciated and perhaps it will help me learn a bit more about how to use the for
loop. I know this is probably something very simple, so please excuse me for being so ignorant.
This works for what I need. Thank you for the help and the references to help me understand what I am doing. – BillH – 2017-04-08T17:20:52.007