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. Compare a text file containing file names with files in a folder

    in Windows 10 Software and Apps
    Compare a text file containing file names with files in a folder: Hi, I have a text files containing a list of file names and I wish to compare that to a folder with files in it. The folder contains a rather large number of files and I want to see if files in that folder exist in the file with the list of file names. Hope I have explained...
  3. 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
  4. Run a .bat file as Admin During Startup

    in Windows 10 Customization
    Run a .bat file as Admin During Startup: Hello, I have a batch file that executes certain commands and one of these commands requires admin privilege. When I place this file in the startup folder the command fails. Right clicking on it and setting it to run as admin doesn't work. I am told scripts can be...
  5. 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...
  6. 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...
  7. 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...
  8. On how to run a .ps1 file as Administrator

    in Windows 10 Support
    On how to run a .ps1 file as Administrator: Hello everyone, If you have had a chance of going through the great Brink's Tutorial Apps - Uninstall in Windows 10 (I strongly advice you do), you may have noticed that, if you wish to automatize, at least to a certain extent, the procedure of getting rid of Windows 10...
  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...