Windows 10: Suddenly can't run bat files as administrator

  1.    14 Sep 2015 #1

    Suddenly can't run bat files as administrator


    New, weird, behavior --

    If I right click on a bat file, and Run as Administrator, all I get is a brief flash (perhaps a command window?).
    Just double clicking on it runs as expected (though not elevated, which is what I need).
    If I open an elevated command window and run the bat file within that window it works fine.

    So I have a workaround, but it's still annoying.
    It's always worked as expected in the past, I last used the batch files about a week ago.

    Tested with a simple bat file (echo "hello", pause). Same results.

    The fact that it is only a problem when I try Run as Administrator has me baffled.

    WIn10 Home build 10240, administrator user account
      My ComputerSystem Spec


  2. Posts : 2,033
    Ubuntu14.04x64 MintMate17x64 Win10Prox64
       14 Sep 2015 #2

    How about using: echo "Hello" & pause
      My ComputerSystem Spec

  3.    14 Sep 2015 #3

    topgundcp said: View Post
    How about using: echo "Hello" & pause
    Thanks, but that's irrelevant. I was just indicating that I had duplicated the problem with a simple batch file. (It actually had the commands on two lines).

    The contents of the batch file don't matter, the issue is that the "Run as Administrator" menu popup in Explorer no longer works properly.
      My ComputerSystem Spec


  4. Posts : 558
    Windows 10 Pro/Windows 7 Ultimate
       14 Sep 2015 #4

    Are you right-clicking on the file and running it "as administrator"? Because with Bat files, you should open a Command Prompt (Admin) By pressing Windows key+X, then after it is open, CD to the folder where the BAT files are, and then run it. That way, you can see if it ran or if it failed.
      My ComputerSystem Spec

  5.    14 Sep 2015 #5

    XweAponX said: View Post
    Are you right-clicking on the file and running it "as administrator"? Because with Bat files, you should open a Command Prompt (Admin) By pressing Windows key+X, then after it is open, CD to the folder where the BAT files are, and then run it. That way, you can see if it ran or if it failed.
    Opening an elevated command prompt, as you describe, and as I mentioned, does work.
    Right-click, Run as Administrator no longer works. It used to.
    Running non-elevated, either by double-clicking or via opening a command prompt works (though then various commands fail due to lack of permission, as expected.)

    The weird thing is that right-click, Run as Administrator stopped working.
      My ComputerSystem Spec

  6.    14 Sep 2015 #6

    Well, I think I've got it, and it's definitely one of the more bizarre Microsoft bugs I've run into:

    The right-click, Run As Administrator function in File Explorer fails if the path to the target contains both an at sign (@) and a space.

    For example these paths work:
    D:\foo\bar\foobar\
    D:\foo\bar\foo bar\
    D:\@foo\bar\foobar\
    D:\@foo\bar@\foobar\

    But these prevent the target (batch file) from running:
    D:\@foo\bar\foo bar\
    D:\foo\bar\@foo bar\

    Or perhaps the actual bug is slightly different, but from the limited testing I performed, it's only the specific combination of @ and space, somewhere in the path, that causes failure. Other (non-reserved) special characters and unicode characters seem to work just fine.

    Weird.
    I'd love to hear an explanation, if anyone has one :-)
      My ComputerSystem Spec


 

Related Threads
Solved Optimization not available suddenly on SSD in Performance & Maintenance
Hi, I have a strange problem. Suddenly optimization is not available for my SSD partitions in the Win 10 defrag tool. Before you say defrag is not done on SSD let me say that I checked and the Win 10 tool auto detects its SSD and preforms TRIM...
Run as administrator - Add to MSI File Context Menu - Windows 7 Help Forums Is this still applicable for windows 10? I have not yet attempted to do this. In my Downloads folder there are right click options to Install / Repair / Uninstall...
Windows 10 - Suddenly Crashing On Startup in Performance & Maintenance
Hi all, I have started experiencing some problems over the last few days in relation to the startup of Windows 10. I'm not overly sure why, but recently when I have been starting the computer for the first time in any given day, the wheel that...
I was installing W10 and got that black screen with the big white circle. Then, once it restarted. When it booted again, suddenly a screen came up saying "Attempting to Recover Installation" then saying "Restoring your previous version of...
...and completely unusable...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 07:47.
Find Us