Page 1 of 2 12 LastLast
  1.    09 Feb 2017 #1
    Join Date : Feb 2017
    Posts : 7
    Windows 10

    Run .BAT as admin without UAC prompt?


    Edit: Marked as "Solved", because it looks like under Win 10 I can no longer do this quite the way I used to in Win 7, and I have multiple suggestions as to alternate approaches, any one of which ought to work.

    ((Moved from the "General" forum))

    Can anyone help? I am trying to run a .BAT script that needs admin privileges, and I need to lose the annoying UAC prompt. I found out how to do that under Win 7, but can't get the same approach to work under Win 10.

    I have created a task with "Run with highest privileges" to start my script. I then attempt to start it from a desktop shortcut. That works fine under WIn 7, and I've seen a couple of tutorials saying that it works under WIn 10 as well - but I can't get it to.

    If I run the new task from within Task Scheduler, to check it out, it does exactly what I expect it to.

    When I simply attempt to run it from the desktop shortcut (using a command of format schtasks /run /tn "mytask"), though, all that happens is that a window of some sort pops and disappears way too fast for me to see what it is trying to tell me (I've tried looking in event viewer for some sort of indication as to what it's objecting to, but can't see anything relevant). Under Win7, my script would execute successfully at this point.

    If I finally cave in and choose to launch the shortcut with "Run as Administrator", the script executes OK - but that merely triggers the very UAC prompt I'm trying to avoid.

    The account I'm using is an administrator. My script, amongst other things, executes runas.exe to launch a .EXE file under a second admin account.

    Any bright ideas? Or other ways to achieve the same result?
    Last edited by Doghouse; 13 Feb 2017 at 04:52.
      My ComputerSystem Spec
  2.    09 Feb 2017 #2
    Join Date : Jun 2015
    Posts : 1,894
    Windows 3.1 to Windows 10

    You could disable UAC via control panel...

    I have a lot of scripts that bypass the admin - but UAC always pops-up
      My ComputerSystem Spec
  3.    10 Feb 2017 #3
    Join Date : Feb 2017
    Posts : 7
    Windows 10
    Thread Starter

    Quote Originally Posted by Kyhi View Post
    You could disable UAC via control panel...
    I could, sure. But that's a bit like cutting off a leg because you've lost your toenail clippers. In principle I'm happy with UAC being on. This is for something I run regularly, and trust; I was looking for something a little less... ...extreme.

    Plus, frankly, it's frustrating that something that worked OK under Win 7 doesn't seem to want to work under Win 10, when it's not obvious why it shouldn't (and when other people also seem to think that it still should). I'd like, if I can, to understand why, and whether it can be made to.
    Last edited by Doghouse; 10 Feb 2017 at 03:40.
      My ComputerSystem Spec
  4.    10 Feb 2017 #4
    Join Date : Jul 2014
    Serbia
    Posts : 10,424
    W10 Insider + Linux

    It's part of tightened security in W10. Can't have both security and letting anything to run loose without at least a warning.
      My ComputersSystem Spec
  5.    10 Feb 2017 #5
    Join Date : Jul 2014
    San Jose, California
    Posts : 2,146
    Ubuntu14.04x64 MintMate17x64 Win10Prox64

    Create a reg file with code below and merge into the registry to avoid UAC prompt from bat file:
    Windows Registry Editor Version 5.00

    Code:
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{E2F13B98-650F-47DB-845A-420A1ED34EC7}User\Software\Microsoft\Windows\CurrentVersion\Policies\Associations]
    "LowRiskFileTypes"=".exe;.bat;.cmd;.vbs"
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Associations]
    "LowRiskFileTypes"=".exe;.bat;.cmd;.vbs"
      My ComputerSystem Spec
  6.    10 Feb 2017 #6
    Join Date : Sep 2015
    Staffordshire
    Posts : 361
    Windows 10 Pro

    Compile the bat file and create it as an exe and the problem should go away. I use Batch Compiler Batch Compiler | Home | Freeware IDE compile convert bat to exe advance batch commands debugger and resources
      My ComputersSystem Spec
  7.    10 Feb 2017 #7
    Join Date : Feb 2017
    Posts : 7
    Windows 10
    Thread Starter

    Quote Originally Posted by CountMike View Post
    It's part of tightened security in W10. Can't have both security and letting anything to run loose without at least a warning.
    Except that I can set a trigger on my task and have it run (say, at a time of my choosing) successfully, without further interaction, and without a prompt. Or run it straight from the Task Scheduler. But if I want to launch it conveniently...?

    Apparently, even though I'm an admin, I'm not safe with matches.
      My ComputerSystem Spec
  8.    10 Feb 2017 #8
    Join Date : Feb 2017
    Posts : 7
    Windows 10
    Thread Starter

    Quote Originally Posted by topgundcp View Post
    Create a reg file with code below and merge into the registry
    Thanks. If all else fails, I'll probably go that route.
      My ComputerSystem Spec
  9.    10 Feb 2017 #9
    Join Date : Feb 2017
    Posts : 7
    Windows 10
    Thread Starter

    Quote Originally Posted by clam1952 View Post
    Compile the bat file and create it as an exe and the problem should go away. I use Batch Compiler Batch Compiler | Home | Freeware IDE compile convert bat to exe advance batch commands debugger and resources
    Thanks, I'll take a look.

    (Edit: Haven't tried this yet, but you're probably right that this should work; plenty of people discuss taking this approach, but every reference I see now talks about "programs". I guess that WIn 7 was slightly more lax in allowing .BAT as well.)
    Last edited by Doghouse; 13 Feb 2017 at 04:50.
      My ComputerSystem Spec
  10.    10 Feb 2017 #10
    Join Date : Jun 2015
    Posts : 1,894
    Windows 3.1 to Windows 10

    Guess, I'll have to do a little testing with the suggestions above, as well...
    Thanks..
      My ComputerSystem Spec

 
Page 1 of 2 12 LastLast


Similar Threads
Thread Forum
Start menu -> Command prompt -> right click -> run as admin = error
I have a problem that seems (to me at least) to be quite common as well as annoying when it happens because you don't know when it started occurring and have no way to fix it, which is why I am finally asking after all these years. The problem...
General Support
Blank screen trying to run Command Prompt as Admin or Install Virus So
Hello, i'm getting a Blank, Black screen when i try to run the Command prompt as an Admin, install McAfee Virus software and when trying to update to the latest Java update version. I'm not 100% sure, but this problem seems to have started after...
AntiVirus, Firewalls and System Security
No Admin Access /Cannot change existing user accounts to admin account
Hello All, I'm delighted to have found you and after a long day of trying to help myself i am now requiring your much appreciated assistance please!:cry: I'm not a techy person at all and am hoping someone can help:) Last week my husband purchased...
User Accounts and Family Safety
System error 5 | No admin rights | Lost admin password | can't reset
Hi Yet again, Windows is frustratingly taking up all of my time and I have tried everything google has to offer to try and fix it but it seems like no one has screwed up as much as I have on whatever forum. Let me explain the problem: I'm...
User Accounts and Family Safety
Google Earth won't install - admin privileges required (I am admin)
Frustrated with admin rights - Please help me. Just purchased new PC - HP Pavilion desktop and upgraded to Windows 10 during installation. I've downloaded Google Chrome as my default search engine with no issues. I've attempted several times to...
Software and Apps
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 12:57.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums