|
本帖最后由 dos时代菜鸟 于 2023-10-14 16:42 编辑
其实可以不用手动输入 账户名,可以用选择的
users.7z
(532 Bytes, 下载次数: 2)
比如:
- @echo off
- SETLOCAL ENABLEDELAYEDEXPANSION
- :start1
- cls
- set n=0
- echo ===本地账户列表========================================================================
- for /f "tokens=2,3 delims=," %%c in ('"wmic useraccount get name,sid,status /format:csv"') do (
- if not "%%d"=="" ( if /i not "%%d"=="sid" ( set /a n+=1 && echo !n! %%c && set "sid_!n!=%%d"))
- )
- echo ----------------------------------------------------------------------------------------
- set /p m=请选择一个账号(1-!n!,0退出):
- if !m! equ 0 goto :eof
- if not defined sid_!m! (
- echo 用户不存在,按任意键重新选择.... && pause >nul && goto start1
- ) else (
- for %%m in (!m!) do ( set "usid=!sid_%%m!" && echo !usid! )
- )
- pause
复制代码 |
|