1.

Solve : Parsing the output of net view?

Answer»

Hey again. I'm WONDERING if there's any way to parse the output of net VIEW, so that there is no remark, only the computer name? I can get past the header and footer by skipping them in my search, but it's the remark that is really killing me here (I'm trying to search each line for the computer name, and then search that computer).

So, can you help?



Thanks, Dark Blade.As always, there is more than one way to to this, but this should work:

From the command line:
Code: [Select]for /f "tokens=1*" %X in ('net view ^| find "\\"') do echo %x

From a batch file, double up on the percent symbols:
Code: [Select]for /f "tokens=1*" %%x in ('net view ^| find "\\"') do echo %%x


Well, I've thought of another way, which is the one I'll use. I'm going to use for, with the DELIMITER of space (with is the default ANYWAY), so I'll only get the computer name. But if that fails, I'll use your approach. Anyway, thanks for your help .

--Dark Blade



Discussion

No Comment Found