0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Windowsバッチファイルのメモ

Last updated at Posted at 2019-06-25

#findstr(id-list.cmd)

rem アカウントIDから情報抽出
rem 準備ファイル:id-list.txt
rem id-list.txtの内容:ユーザー名(sAMAccountName)を一行ごとに羅列

rem カレントディレクトリを実行ファイルのある階層に設定
pushd %~dp0
rem ドメイン環境下の場合は OPT=/domain
set OPT=

rem id-list.txtの内容を読み込んで、キーワード「ユーザー名」「コメント」「アカウント有効」を抽出
for /f %%i in (id-list.txt) do net user %OPT% %%i | findstr "ユーザー名" && net user %OPT% %%i | findstr "コメント アカウント有効"

rem ※バグなの?>findstrのor検索では1行目が表示されない
rem ※不細工だけど&&で繋いで対処

pause
exit
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?