Search found 2 matches
- 24 Apr 2012 16:32
- Forum: DOS Batch Forum
- Topic: Check if the file was run as an admin?
- Replies: 9
- Views: 9383
Re: Check if the file was run as an admin?
Checking the error code of "at" is a better hack because you don't have to create temporary files. at > nul if %errorlevel% neq 0 ( echo No administrative privileges. ) Of course what you should do if you are really concerned about levels of access is to check exactly who has access to AT...
- 24 Apr 2012 15:00
- Forum: DOS Batch Forum
- Topic: Check if the file was run as an admin?
- Replies: 9
- Views: 9383
Re: Check if the file was run as an admin?
This might work too. @echo off md "%windir%\a-test" 2>nul&& (echo You're admin & rd "%windir%\a-test") || echo Not admin That's a faster, more secure way, I think. Creating and removing a temporary file/folder is more like a hack. How is this better? This hack depend...