![](https://batch-file.net/wp-content/themes/cocoon-master/images/b-woman.png)
バッチファイルで
・ユーザーを削除
できます!
コード
ここでは例として
・ユーザー「taro」を削除
します。
![ユーザー「taro」](https://batch-file.net/wp-content/uploads/2022/11/bat_delete_user_001.png)
@echo off
rem 削除するユーザー名
set userName=taro
rem ユーザーを削除
net user %userName% /delete
rem 実行結果を確認
if %errorlevel% == 0 (
echo 正常終了しました。戻り値:%errorlevel%
) else (
echo 異常終了しました。戻り値:%errorlevel%
)
pause
exit
実行結果
ユーザーを削除できました。
![実行結果①](https://batch-file.net/wp-content/uploads/2022/11/bat_delete_user_003.png)
![実行結果②](https://batch-file.net/wp-content/uploads/2022/11/bat_delete_user_004.png)
参考①
ユーザーを作成することもできます。
詳細は以下の記事をご確認ください。
参考②
上記で使用した以下の詳細は、公式サイトをご確認ください。
●「net user」コマンド