Saved Bookmarks
| 1. |
Solve : How can I detect if a batch file is started as admin?? |
|
Answer» How can I detect if a batch file is started as administrator? You could check your event log. No I mean check admin from within the batch file. ..Code: [Select] if "%username%"=="Administrator" ( echo User is Administrator ) else ( echo User is not Administrator ) Quote from: SALMON Trout on January 09, 2010, 02:38:02 PM Code: [Select]Quote from: Helpmeh That ony applies to the Administrator account. I assume the OP wants to make sure the user has RUN the batch as an administrator. Although I have 0 experence in this, I use XP. In that case, Vista & 7 have the whoami command. Type whoami /? at the prompt for full information. Quote from: Salmon Trout on January 09, 2010, 05:54:54 PM In that case, Vista & 7 have the whoami command. Type whoami /? at the prompt for full information.Well isn't that neat. Can you post it? I don't have vista or 7 so I can't SEE for myself. Quote from: Helpmeh on January 09, 2010, 06:00:00 PM Well isn't that neat. Can you post it? I don't have vista or 7 so I can't see for myself.I don't know if this is what you are looking for, Google works great though Quote from: Quantos on January 09, 2010, 06:03:51 PM I don't know if this is what you are looking for, Google works great thoughSpot on quantos! |
|