Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Bat file running as administrator does not work

02 Aug 2014   #1

Windows 7 Home Premium 64bit
Bat file running as administrator does not work

Here is my test bat file:
@echo off
echo "Hello David"

If I run this very simple bat file in a user account or admin account, or in an elevated command window, it works fine - I see the text and the pause - no errors. But if I run the bat file as Administrator (mouse right click) or use a shortcut to the bat file that runs as administrator, the window appears and immediately disappears. I do not see the text or the pause. Why? What am I missing?

My System SpecsSystem Spec
02 Aug 2014   #2

64-bit Windows 10 Pro

Hello David,

It may be an issue with the registry for "Run as administrator". If you like as a test, use step 2 in the tutorial below to restore "Run as administrator" to the context menu. This will also restore the default registry entries for it, and hopefully allow it to run properly afterwards. :)

Run as Administrator - Add or Remove from Context Menu in Windows 7
My System SpecsSystem Spec
10 Nov 2018   #3

Windows 7

I found the answer to this very annoying issue in my case was simply that the name of my batch file contained an Ampersand ("&") and Windows 10 (and Windows 7) for some reason do not like having this character in the file name when combined with the "Run as Administrator" option - either from the right-click context menu, or ticked in the icon. Stupid, really, since everywhere else an Ampersand seems to be a valid character for a file name....

Thus the reason that "Pause" didn't work was because it never even opened the file to begin running commands.
My System SpecsSystem Spec

10 Nov 2018   #4

Win 10 x64, Linux Lite, Win 7 x64, BlackArch, Kali, VMWare Workstation Player, OpenVPN

Excellent troubleshooting MiTuCents

Please mark this thread as resolved.
My System SpecsSystem Spec

 Bat file running as administrator does not work

Thread Tools

Similar help and support threads
Thread Forum
Process - See if running as administrator (elevated)
How to See if Process is running as administrator (elevated) in Vista and Windows 7 This tutorial will show you how to determine if a program or process is running as administrator (elevated) or not in Vista and Windows 7. Here's How:
Selectively deactivate UAC without running as administrator
Hi all, I'm facing the following issue : I'm trying to run two programs at the same time but are both troubled by the UAC level. Program 1 does work when the UAC is at level D (lowest) and doesn't work otherwise. In any case, it bugs if ran as administrator Program 2 does work when the...
Question about: running in administrator mode
Hello and Happy new Year to you all. I am having some issue running my compute as an "administrator". I know that because when I run CMD in administrator mode, I stay in the user part not on system32 as explained on a post in the forum and I cannot delete some files or folder. Could...
General Discussion
How to tell if a user is running as Administrator?
I am writing a batch file for a group of people that might or might not know how to run as admin. I would like to know if there are any files or varibles that are different for the admin or the current user.
General Discussion
Running everything as administrator...why?
Finally got x64 RTM installed tonight and everything worked out...mostly. My problem is that I have to run almost everything as an administrator. If I don't, the app will open briefly, then close. But it stays running under just a few megs of RAM in the Task Manager. Happens on Firefox, IE 8...

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:43.
Twitter Facebook Google+