您可以使用以下脚本将当前账号添加到管理员组中:

@echo off

echo Adding current user to administrators group...

net localgroup administrators %username% /add

if %errorlevel% equ 0 (
    echo Current user has been added to administrators group successfully.
) else (
    echo Failed to add current user to administrators group.
)

pause

将以上代码保存为一个扩展名为 '.bat' 的文件,然后双击运行该文件即可将当前账号添加到管理员组中。请确保以管理员身份运行该脚本,否则可能会遇到权限问题。

Windows 批处理脚本:添加当前用户到管理员组

原文地址: https://www.cveoy.top/t/topic/fruq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录