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

Discus and support Suddenly can't run bat files as administrator in Windows 10 Support to solve the problem; 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... Discussion in 'Windows 10 Support' started by CapnM, Sep 13, 2015.

  1. CapnM Win User

    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

    :)
     
    CapnM, Sep 13, 2015
    #1
  2. GlennL17 Win User

    Windows 10 Read Only issue

    I am unable to run the .bat file as an administrator, and when I try to use CMD to open it, it also does not run it. I literally am completely unable to run the .bat file in the folder or in any folders, including my desktop.
     
    GlennL17, Sep 13, 2015
    #2
  3. Windows 10 - can't install updates

    Download, extract run the bat as an administrator.(Right click the wureset.bat file and select run as administrator)
     
    Sumit Dhiman2, Sep 13, 2015
    #3
  4. topgundcp Win User

    Suddenly can't run bat files as administrator

    How about using: echo "Hello" & pause
     
    topgundcp, Sep 13, 2015
    #4
  5. CapnM Win User
    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.
     
    CapnM, Sep 13, 2015
    #5
  6. XweAponX Win User
    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.
     
    XweAponX, Sep 13, 2015
    #6
  7. CapnM Win User
    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.
     
    CapnM, Sep 13, 2015
    #7
  8. CapnM Win User

    Suddenly can't run bat files as administrator

    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 Suddenly can't run bat files as administrator :)
     
    CapnM, Sep 13, 2015
    #8
  9. onix Win User
    Came across the exact same problem as CapnM on Windows 10 Pro 64-bit, where batch file does not "Run as Administrator" upon a right-click, but does from an elevated command prompt. But I don't think his suggestion applies to this .bat script that deletes OneDrive:

    taskkill /f /im OneDrive.exe
    %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
    rd "%UserProfile%\OneDrive" /Q /S
    rd "%LocalAppData%\Microsoft\OneDrive" /Q /S
    rd "%ProgramData%\Microsoft OneDrive" /Q /S
    rd "C:\OneDriveTemp" /Q /S
    REG Delete "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
    REG Delete "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
    pause

    Additional suggestions, or ideas welcome.
     
  10. dalchina New Member
    Hi, does 'Run as admin' work on anything?

    Users who have had problems with this have found there's another shell extension present, which, when disabled, magically allows Run as admin to work again.

    Try disabling other (non-MS) context menu entries using
    Shellexview
    Shellmenu
    (free)

    Remember to make sure MS entries are hidden in Options (they should be by default) as disabling them can cause difficulty.

    Two recent examples were
    winrar and something like quicksfv
     
    dalchina, Nov 15, 2017
    #10
  11. onix Win User
    I got my old scripts to work. I moved them to the root level directory on C:\ All is back to normal.
     
  12. Same as above . . . I tried to Run As Administrator from context menu on a bat file. (not a cmd file). Did not work when the file was on the desktop, just a dialog flash and disappear as op said. Moved file to root of c:, ran same command same way, worked fine. Anyone have any ideas or answers? Permissions issue? Running Win10Home x64
     
    smithcferg, Apr 4, 2018
    #12
Thema:

Suddenly can't run bat files as administrator

Loading...
  1. Suddenly can't run bat files as administrator - Similar Threads - Suddenly can't run

  2. Is it safe to run this bat file?

    in AntiVirus, Firewalls and System Security
    Is it safe to run this bat file?: Spo I was wondering how to get sandbox on windows 10 home and I came across this forum saying that I could run this bat file to try and install it.Enable Windows Sandbox Feature in Windows 10 Home Edition Tutorials tenforums.comThe bat file I downloaded was not blocked by...
  3. Can't run .bat files

    in Windows 10 Support
    Can't run .bat files: I haven't run a .bat file in quite a while, so perhaps I unknowingly did something along the was that prompted this problem. I was trying to run Brinks "Reset_Notification_Area_Icons_Cache.bat", but instead the file opens in my text editor. I disassociated .bat in that text...
  4. Can't open .bat files

    in Windows 10 Ask Insider
    Can't open .bat files: I want to open a .bat file. I double click on it, it appears on the screen in less then 1 second and then it disappears. What can I do? submitted by /u/Dieghito03 [link] [comments] https://www.reddit.com/r/Windows10/comments/fl7csj/cant_open_bat_files/
  5. Running .bat file as administrator from a folder containing "&" doesn't work?

    in Windows 10 Network and Sharing
    Running .bat file as administrator from a folder containing "&" doesn't work?: So, as any other user that respects himself and his sanity, i have a collection of tiny .bat files that i have created for automatically fixing all kinds of annoyances M$ has blessed us with, everything from certain permissions to reg values, all nicely stored in one folder...
  6. How to run a .bat file as administrator in startup?

    in Windows 10 Support
    How to run a .bat file as administrator in startup?: Hello. As BitDefender as an ongoing error, I want to run a small "bdfix.bat" at login time. But this .bat file MUST be run as an administrator to work. How do I do that? *Redface 120997
  7. Bat Files Won't Run?

    in Windows 10 Gaming
    Bat Files Won't Run?: Basically I'm installing BattlEye for a Steam game and I click the .bat file in the game's subfolder to download it (when I was prompted to download it I clicked no but now I practically need it for most servers), and I download the .bat from the main website and it also...
  8. Trouble running .bat files

    in Windows 10 Support
    Trouble running .bat files: Hi, I'm trying to run .bat files on Windows 10, but it tells me that "This app can't run on your PC". It doesn't matter what I use it for, .bat files just won't run anyway. Are .bat files no longer supported? (ran fine on Windows 7) Any workarounds? I'm no expert on...
  9. Can't Run .Bat Files

    in Windows 10 Support
    Can't Run .Bat Files: I try to run .bat files and the just run in note pad. There is no "open with" option. 48199
  10. Have a .bat file start up as "run as administrator" in start up.

    in Windows 10 Support
    Have a .bat file start up as "run as administrator" in start up.: Hi, Let me start with my setup. In File explorer I have a library called "Start up" . This contains 2 paths: Path 1 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup and Path 2 C:\Users\AJ ANNING\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup...