Windows 7 CMD Access is Denied

Sunday, November 1, 2009

Access is Denied

Windows 7 installed without a hitch, but I noticed that the bat files I use to turn certain programs on and off no longer worked. Specifically, I have bat files that use “NET START” and “NET STOP” to toggle Windows Services. When I’d run those, I’d get “Access is Denied”. This was particularly annoying b/c I use Launchy to run these bat files to quickly set up and tear down an environment, and this new “security feature” was breakin’ my stride. Here’s how to remind Windows that you are its boss.

Do As I Say, Dammit!

Set Command Prompt to Run As Administrator

  1. From the Start menu, filter on “Command Prompt”
  2. Right click on it, select “Properties”. In the “Shortcut” tab, click the Advanced button.
  3. Check the “Run as Administrator” checkbox
  4. Restart your computer

Here’s a screenshot of what these boxes look like (taken with the new Windows 7 “Snipping Tool”):

commandpromptproperties

It was my experience that you need to restart your computer. When I changed these settings initially, it didn’t change the behavior of my bat files at all. Only after restart did my “Access is Denied” problems go away.

Good luck.

--Marc

6 comments:

Roger Champagne said...

Thank you so much, I just installed Windows 7 and was going nuts with this issue, which I realize now was causing me trouble in more than one way.

I did not need to reboot, after clicking on "Run as administrator", windows opened a new command prompt with the new settings. Perhaps they changed something.

Roger

Marc Esher said...

Glad it helped!

Jim said...

Marc - I'm curious if this is still working for you? I've tweaked my cmd.exe, rebooted and still get an access denied. The only way I can run my scripts is to manually kick off cmd.exe with admin privs - then run my batch. Frustrating!

Marc Esher said...

Jim, it is. In fact, I just set up a new machine last week, and I had to return to this post to remember how to do it. But after applying that setting, it's working.

Curiouis: Do you have UAC turned all the way down?

Jim said...

Yes - doing that, actually I disabled it, finally seems to have done the trick.

Do you have UAC 'on', 'low' or disabled? Now that I have it

Marc Esher said...

Jim, I have it turned all the way down. To me, Windows is virtually unusable with UAC turned on