0

I am using Windows 7 Professional, when I tried to type net stop <service name> in the command prompt, it is showing

System Error 5 occurred

I know that I need to enable Run as administrator mode but if I want to put net stop/start <service name> in batch file so that it don't require user to right-click on that batch file and Run as administrator everytime, is there a way to solve this problem.

Note that the end-user's ID already has administrators rights.

Thanks.

Jubin Justifies
  • 397
  • 4
  • 12
john lam
  • 11
  • 2
  • this link may be helpful for you: https://stackoverflow.com/questions/6811372/how-to-code-a-bat-file-to-always-run-as-admin-mode – Nipun Aug 14 '17 at 04:46
  • Using the Administrator (RID 500) account isn't a good option because it has to be manually activated on a system. Using a shortcut set to run with administrator rights might be ok, but the prompt for consent may be annoying. – Eryk Sun Aug 14 '17 at 06:43
  • Thanks Nipun reply, end-user is not using Administrator account, he has own ID but the ID has admin. rights – john lam Aug 14 '17 at 07:48

3 Answers3

1

I finally found the solution, just checked mark on "Run as Administrator" on shortcut.

Enable run as administrator:

enter image description here

JosefZ
  • 28,460
  • 5
  • 44
  • 83
john lam
  • 11
  • 2
0

Quicker way to get Administrator Command Prompt:

  1. Press Windows Start button.
  2. Enter cmd in the bottom-left field,followed by Ctrl-Shift-Enter.

You can then enter privileged commands in the new Administrator Command Prompt window (which should have "Administrator" as the first word in the window title). Your Admin privileges end when you exit Administrator Command Prompt. This works on Windows 7, 8.1, and 10. It may work on other versions; try it.

-1

It happens when you are doing some intensive task on your operating system that can modify some changes on that, for the security reason Windows always wants to do that task as Administrator Account. Reopen the CMD with "Open as Administrator" and there you go. Process

  1. Go to Search Box
  2. Type CMD
  3. Right Click on that
  4. Run as Administrator
Daniel Quinlan
  • 2,639
  • 1
  • 20
  • 23
  • Please don't promote yourself on stackoverflow! Moreover your answer don't solve the problem of the question because he don't want to open the script has administrator manually. – johannchopin Jan 03 '20 at 10:48