0

At first: Yes, I know different answers like this, but this is not what I want ...

I have a Batch script (on Win7) which must be executed with Administrator rights. To do that the user must right click the Batch file and select "Runs as administrator" to execute the script. The "NET SESSION", "AT" and so on solutions of answers like in the link above doesn't not work, because "NET SESSION" returns me the same result: there is no different if I start the Batch file with a double click or if I start it while selecting "Run as Administrator". But I need to find out if the Batch file is started with "Run as administrator" ...

Any Solutions for that?

Community
  • 1
  • 1
Steffen
  • 1,459
  • 3
  • 21
  • 39
  • See [this answer](http://stackoverflow.com/questions/6811372/how-to-code-a-bat-file-to-always-run-as-admin-mode) – Kao Jul 15 '14 at 07:35
  • @Kao: Thanks, but the user is already a adminsitrator. I must "only" check if the Batch is realy started with "Run as Administrator" like it was described here: http://stackoverflow.com/a/13811519/1465758 – Steffen Jul 15 '14 at 08:03
  • @Steffen is a shortcut to the batch (with "run as administrator" thick) an option? – npocmaka Jul 15 '14 at 08:13
  • @npocmaka: The question is: How can I (inside the Batch program) find out if the the Batch was started with "Run as Administrator"? – Steffen Jul 15 '14 at 08:17
  • 1
    @Steffen - the link you provided answers this in fact – npocmaka Jul 15 '14 at 08:26
  • Yes, that right. See also at my answer. Thanks! – Steffen Jul 16 '14 at 06:11

1 Answers1

0

Ok. Thanks for your comments. Today I figure out what happens.

Our admin has change the configuration of the cmd.exe application so that the cmd.exe starts in every case with administration rights. So theres no different between a double click on "cmd.exe" and starting it with "Run as Adminstrator". And so my script returns the same result in both cases!

Steffen
  • 1,459
  • 3
  • 21
  • 39