Listing 1: Code That Parses the Net User Command's Output Set account = myuser1 For /f "tokens=2,3 delims=*" %%i in ('Net User %account% /domain ^| Find "*"') Do Call :splitgroups "%%i" "%%j" Goto :EOF :splitgroups Set group1=%1 Set group2=%2 BEGIN COMMENT :: Clear the trailing spaces. END COMMENT Set group1=%group1: =% Set group1=%group1: "="% Set group1=%group1:"=% Set group2=%group2: =% Set group2=%group2: "="% Set group2=%group2:"=% BEGIN COMMENT :: Write to a temporary file. END COMMENT If Not "%group1%"=="" echo %group1% >> %temp%\getaccess.$$$ If Not "%group2%"=="" echo %group2% >> %temp%\getaccess.$$$ Goto :EOF