![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-03 10:53 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Statistical user group information |
| Printable Version 3,000 / 51 |
| Floor46 qingfushuan | Posted 2007-02-10 07:49 |
| 高级用户 Posts 327 Credits 502 | |
|
Try again step by step.
I need to go home. The following examples are for your reference. @echo off echo All user account IDs are: echo. for /f "skip=4 tokens=1-3" %%i in ('net user') do ( if not "%%i"=="The command completed successfully." echo %%i if not "%%j"=="" echo %%j if not "%%k"=="" echo %%k ) echo. echo The current user account ID is: %username% pause>nul Show progress bar.bat @echo off :: code by jm 2006-11-30 CMD@XP set var=">" set/p=Loading: <nul ping -n 2 127.1>nul for /l %%i in (1,1,20) do ( set/p=%var%<nul ping -n 2 127.1>nul ) echo. echo. pause |
|
| Floor47 yuipr | Posted 2007-02-10 08:29 |
| 初级用户 Posts 25 Credits 52 | |
|
According to your method, it can display the user, but the user's information still hasn't been displayed.
|
|
| Floor48 qingfushuan | Posted 2007-02-10 22:05 |
| 高级用户 Posts 327 Credits 502 | |
|
for /f "skip=4 tokens=1-3" %%i in ('net user') do (
if not "%%i"=="命令成功完成。" echo %%i >>1.txt if not "%%j"=="" echo %%j >>1.txt if not "%%k"=="" echo %%k >>1.txt ) for /f %%a in (1.txt) do net user %%a | find "Username" ::for /f %%a in (1.txt) do net user %%a | find "Local group members" ::for /f %%a in (1.txt) do net user %%a | find "Global group members" [ Last edited by qingfushuan on 2007-2-10 at 09:53 AM ] |
|
| Floor49 yuipr | Posted 2007-02-10 22:15 |
| 初级用户 Posts 25 Credits 52 | |
|
###
Originally posted by qingfushuan at 2007-2-10 09:05 AM: The result of this script execution __vmware_user__ Administrator Guest HelpAssistant SUPPORT_388945a0 hasn't counted the group information of the users yet, brother, take another look? |
|
| Floor50 qingfushuan | Posted 2007-02-10 23:00 |
| 高级用户 Posts 327 Credits 502 | |
|
@echo off
for /f "skip=4 tokens=1-3" %%i in ('net user') do ( if not "%%i"=="命令成功完成。" echo %%i >>1.txt if not "%%j"=="" echo %%j >>1.txt if not "%%k"=="" echo %%k >>1.txt ) for /f %%a in (1.txt) do net user %%a | find "Username"&net user %%a | find "Local Group Members"&net user %%a | find "Global Group Members" [ Last edited by qingfushuan on 2007-2-10 at 10:07 AM ] |
|
| Floor51 qingfushuan | Posted 2007-02-10 23:38 |
| 高级用户 Posts 327 Credits 502 | |
|
@echo off
for /f "skip=4 tokens=1-3" %%i in ('net user') do ( if not "%%i"=="命令成功完成。" echo %%i %%j %%k >>1.txt ) for /f %%a in (1.txt) do net user %%a|findstr /r "用户名 本地组成员 全局组成员" I'm a newbie learning while answering your question, sorry about that. Can the above be further simplified? I think it should be possible without generating 1.txt? [ Last edited by qingfushuan on 2007-2-10 at 11:28 AM ] |
|
| Floor52 oilio | Posted 2007-02-10 23:43 |
| 高级用户 Posts 303 Credits 641 | |
|
%username% always refers to one user, and it won't list all users. Directly using net user will list all usernames, and using echo %username% is the username of the user who is currently logged in to the computer.
|
|
| Prev 1 2 3 4 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |