Windows 10: Running .bat file as administrator from a folder containing "&" doesn't work?

Discus and support Running .bat file as administrator from a folder containing "&" doesn't work? in Windows 10 Network and Sharing to solve the problem; 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... Discussion in 'Windows 10 Network and Sharing' started by Vlad L., Feb 20, 2019.

  1. Vlad L. Win User

    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 i've named "Configs, Fixes & Tweaks".


    Now for my problem: pretty much what i said in the title. I noticed that while normal "unelevated" runs of said .bat files work without a hitch, if i have to run them as administrator it simply fails, the explorer window flashes for a second but nothing happens. I noticed this behavior only happens if the folder you run the .bat from contains a "&" symbol in it's name (may also happen with other symbols, i haven't tested), so as you saw above, my folder does have this character in the name and i don't really intend to change it, if it can be helped. You can even test this for yourself, make a new folder, name it "somethingsomething&" and add any .bat file in there (even an empty one) and try to run it via right click> run as administartor.

    Is there any way to bypass this? Do i have to include something in my file so that it would run? some sort of path? I tried searching this issue but apparently nobody has ever encountered this issue. Am i missing something?

    :)
     
    Vlad L., Feb 20, 2019
    #1
  2. CapnM Win User

    Suddenly can't run bat files as administrator


    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, Feb 20, 2019
    #2
  3. XweAponX Win User
    Suddenly can't run bat files as administrator


    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, Feb 20, 2019
    #3
  4. CapnM Win User

    Running .bat file as administrator from a folder containing "&" doesn't work?

    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, Feb 20, 2019
    #4
Thema:

Running .bat file as administrator from a folder containing "&" doesn't work?

Loading...
  1. Running .bat file as administrator from a folder containing "&" doesn't work? - Similar Threads - Running bat file

  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. Folder disappears from networked drive after running .BAT file

    in Windows 10 Network and Sharing
    Folder disappears from networked drive after running .BAT file: I am simply trying to run a .BAT file on a mapped network drive, on a workstation running Microsoft Windows 10 Enterprise. After many different approaches at solving this issue, I finally got to the point where I created an empty .BAT file. I ran it from that folder, and the...
  5. How to run bat File from Right Click Menu in specific folder ?

    in Windows 10 Customization
    How to run bat File from Right Click Menu in specific folder ?: Is it possible to run a .bat or .exe from the Right-Click Context menu as if it was actually running from a specific folder that I call up the context menu from ? Example : The .bat works with files in the folder its placed in with . The way its written is it has to be in...
  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. Suddenly can't run bat files as administrator

    in Windows 10 Support
    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...
  9. 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...
  10. 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