Windows – Access denied when using net stop/start via CLI on Windows 7

batchcommand linewindows 7

I have a Windows service that needs to be stopped and restarted when switching to a different development server (I'm a web developer.) If I go into the Services GUI, I can stop and restart the service with no problem. My colleague has a batch file that works for him, so I tried to use it, and it's giving me Access Denied errors. I've tried running the file as administrator, and even just running the commands directly in the cmd window. Still get the error.

The file is simply:

net stop "Service Integration Gateway"
net start "Service Integration Gateway"
pause

I found this answer on StackOverflow, and tried using the runas command like this:

runas /user:Administrator net stop "Service Integration Gateway"

but all it did was give me the readme on runas, so I'm guessing I can't use it with the net stop command, or I'm using it wrong.

What do I need to do to be able to run these commands via CLI/batch?

EDITED TO ADD SCREENSHOT AS REQUESTED:

Running as Admin

enter image description here

Best Answer

Your command prompt screenshot doesn't say "Administrator" at the front so I think possibly you are not doing "run as administrator" correctly. Make sure to right click the bat file and do "run as administrator" which has a yellow/blue shield icon. Do NOT use "run as different user" or assume when logged on as an admin that you have full admin rights. UAC prevents certain actions without further elevation.

enter image description here

enter image description here