![]() |
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:52 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Statistical user group information |
| Printable Version 2,998 / 51 |
| Floor1 yuipr | Posted 2007-02-10 03:47 |
| 初级用户 Posts 25 Credits 52 | |
|
@echo off
for /f "tokens=2 delims=*" %a in ('net user %username%^|find "local"') do @echo %~a How to use this command to prompt an error. [ Last edited by yuipr on 2007-2-9 at 03:21 PM ] |
|
| Floor2 zh159 | Posted 2007-02-10 04:16 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
In batch processing, use `%%a` (double percent signs), and in the command line, use `%a` (single percent sign)
|
|
| Floor3 yuipr | Posted 2007-02-10 04:21 |
| 初级用户 Posts 25 Credits 52 | |
|
Is this the case:
@echo off for /f "tokens=2 delims=*" %%a in ('net user %username% ^|find "local"') do @echo %~a Still no good? [ Last edited by yuipr on 2007-2-9 at 03:23 PM ] |
|
| Floor4 yuipr | Posted 2007-02-10 04:23 |
| 初级用户 Posts 25 Credits 52 | |
Originally posted by zh159 at 2007-2-9 03:16 PM: Could you please explain it again? I'm in a hurry. |
|
| Floor5 zh159 | Posted 2007-02-10 04:27 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
for /f "tokens=2 delims=*" %%a in ('net user %username%^|find "local"') do @echo %%~a
[ Last edited by zh159 on 2007-2-9 at 03:33 PM ] |
|
| Floor6 yuipr | Posted 2007-02-10 04:33 |
| 初级用户 Posts 25 Credits 52 | |
Originally posted by zh159 at 2007-2-9 03:27 PM: Modified according to yours, executed with batch processing, nothing is displayed, no error is seen, so the command execution error is as follows " C:\>@echo off for /f "tokens=2 delims=*" %a in ('net user'%username%'^|find"local"') do @echo %~a 'find"local"' is not recognized as an internal or external command, operable program or batch file. |
|
| Floor7 zh159 | Posted 2007-02-10 04:36 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
Your 'net user'%username%'^|find"local"' writing is completely wrong, there is no space in the middle.
'net user "%username%"^|find "local"' [ Last edited by zh159 on 2007-2-9 at 03:37 PM ] |
|
| Floor8 yuipr | Posted 2007-02-10 04:45 |
| 初级用户 Posts 25 Credits 52 | |
|
According to what you said, it's modified:
C:\Documents and Settings\yichuanj>@echo off for /f "tokens=2 delims=*" %a in ('net user'%username%'^|find "local"') do @echo off for /f "tokens=2 delims=*" %a in ('net user'yichuanj'|find "local"') do @ech oThis is what is automatically displayed after the command is executed. The batch processing still doesn't work. Can you write a complete batch processing for user information statistics and send it here? I've been struggling for a day and still can't get it done. I'm really frustrated. Thanks [ Last edited by yuipr on 2007-2-9 at 03:46 PM ] |
|
| Floor9 zh159 | Posted 2007-02-10 04:50 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
user'yichuanj'
Let's see if you can spot any issues |
|
| Floor10 yuipr | Posted 2007-02-10 04:54 |
| 初级用户 Posts 25 Credits 52 | |
|
My system environment is "domain", this user is a user in the domain and also the user I am currently logged in to the local machine with, and I don't see any problems.
|
|
| Floor11 zh159 | Posted 2007-02-10 04:59 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
net user'%username%'
The space between 'user' and '%username%' is missing, and '%username%' should be enclosed in double quotes "" instead of single quotes '' |
|
| Floor12 yuipr | Posted 2007-02-10 05:10 |
| 初级用户 Posts 25 Credits 52 | |
|
I'm sorry, I made a change.
C:\Documents and Settings\yichuanj>@echo off for /f "tokens=2 delims=*" %a in ('net user "%username%" ^|find "local"') do @echo %~a The user name could not be found. More help is available by typing NET HELPMSG 2221. |
|
| Floor13 yuipr | Posted 2007-02-10 05:16 |
| 初级用户 Posts 25 Credits 52 | |
Originally posted by qingfushuan at 2007-2-9 04:13 PM: C:\Documents and Settings\yichuanj>@echo off for /f "tokens=2 delims=*" %a in ('net user ^|find "local"') do @echo %~a off for /f "tokens=2 delims=*" %a in ('net user |find "local"') do @echo %~a Still not right? |
|
| Floor14 ccwan | Posted 2007-02-10 05:21 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
Does the output of your net user command contain "local"? I don't have it here. So the code doesn't work on my side.
|
|
| Floor15 qingfushuan | Posted 2007-02-10 05:21 |
| 高级用户 Posts 327 Credits 502 | |
|
Execute net user ^| find "local" >>1.txt, 1.txt has no content, which means your sentence is wrong.
|
|
| 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |