5

I have written as small .cmd file to be executed as an administrator. I am trying to set its options as 'Run as Administrator' but the check box is not accessible.

Run As Administrator

Why? How to solve this issue? I am administrator on my PC (Windows 7).

2 Answers 2

3

Create a Shortcut to the .CMD you want to launch (Right-click-->Create Shortcut, or drag-drop with Alt pressed)

Go into the shortcut's Properties-->Shortcut Tab-->Advanced-->Check-mark Run as Administrator

Then launch with the Shortcut instead.

3
  • Thanks. It did the trick. For the records: I had to create a 'set location=C:/Users/etc...' variable in my .cmd and use it with each command to make it work. Commented Sep 21, 2011 at 19:47
  • Glad it worked. Have you considered setting the environment variable permanently instead? Check out SetX, and/or this question: how to set path environment variable amongst others, for some info on that. :) Commented Sep 21, 2011 at 20:02
  • The thing is that I may need to modify it in the future and it is only used in the .cmd. It's not really necessary to make it global (in my case). Commented Sep 21, 2011 at 20:27
2

runas might come to some use for you

1
  • Keep in mind runas only elevates commands if you use the builtin Admin account's credentials and you have autoapproval mode on. Otherwise this will fail due to UAC.
    – surfasb
    Commented Sep 21, 2011 at 21:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .