I have been working with some batch newsgroup on this problem.

I want to be able to determine via a batch file if the current user is limited user.

My set command in my limited user account contains this which may help.

USERNAME=LU
Posted on 2010-08-27 11:11:54 by skywalker


:: Is_Admin.bat Determine if running under an Admin or Limited User account
::               Much help from I'm_Here,foxidrive,Ted Davis  11:26 AM 8/27/2010
::                    Tested on XP Pro SP3
@echo off
Set IsAdmin=True
>NUL 2>&1 DISKPART/?||Set IsAdmin=False

Set IsAdmin
cls

If "%isAdmin%" EQU "True" goto isAdmin
goto end

:isAdmin

echo This is an administrator account.
echo.
echo Proceeding...
echo.     
goto :EOF

:end
echo.
echo Not an Admin
echo.
echo Exiting...
Posted on 2010-08-27 11:29:07 by skywalker
The following commands might be helpful:
net localgroup administrators

whoami


You just need to parse their outputs.


That diskpart thing you posted triggers UAC on win7.

/edit
"whoami" may be replaced by %USERNAME%
Posted on 2010-08-27 12:32:23 by ti_mo_n
Can you see if this works OK with Win 7.
I would like to know if it works with Vista too.


1>nul (net user %username%|find "Administrator")||goto :not_admin
echo Admin
goto :EOF
:not_Admin

echo not admin
Posted on 2010-08-27 12:55:42 by skywalker
Works correctly on win7 without triggering the UAC. The preset admin group's name is "Administrators", not "administrator".

The problem you may encounter is that in different language versions there may be different names fot the admin group.
Posted on 2010-08-27 13:16:17 by ti_mo_n

Works correctly on win7 without triggering the UAC. The preset admin group's name is "Administrators", not "administrator".

The problem you may encounter is that in different language versions there may be different names fot the admin group.


Thanks for testing.

I changed it back to Administrators and it still works.

Posted on 2010-08-27 14:15:00 by skywalker