locked
Executing Batch Script as Standard User RRS feed

  • Question

  • Hello

    I'd like to ask regarding Batch Scripting. Let's say I have a standard user account on a computer and want to run a Batch file but with Administrator priviliges. Is there a way to insert a certain type of code that will bypass or execute instructions with elevated rights, or just saying yes automatically when prompted for Admin rights to proceed with the execution? Main reason is why I'm asking because when I am running a batch script it ignores some of the files that I want to be deleted for a custom made system maintenancing script which deletes internet browsing history etc. And I want this file to be accessible to standard users as well when running but without asking for any credentials, and executing it with admin rights. I was able to find code to input /runas but I couldn't find a proper example. I have Googled my research and watching YouTube tutorials alike but none seem to match my need to solve my problem. Each individual requesting assistance with similar problems regarding using Admin priviliges as Standard user but their problems have their own unique issues which requires me to look further. Any help regarding the matter would be greatly appreaciated.

    Thank you in advance.
    26/07/2014

    Saturday, July 26, 2014 2:13 AM

Answers

All replies

  • Are you in a contest for the longest run-on sentence?

    The answer is no - it is not possible.  Ask your Admin why.


    ¯\_(ツ)_/¯

    Saturday, July 26, 2014 2:38 AM
  • You cannot bypass the UAC prompt, and this is by design. Read this:

    FAQ: Why can't I bypass the UAC prompt?


    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by Bill_Stewart Monday, August 18, 2014 11:31 PM
    • Marked as answer by Bill_Stewart Thursday, August 28, 2014 8:09 PM
    Saturday, July 26, 2014 12:14 PM
  • Then would it be possible whilst logged in through an Administrator account that I insert a code to the batch file which prompts for permission to execute the instructions and saying yes to it automatically but without actually asking for permission from me as the Admin User? Also when I'm running the batch script it's showing its execution process in a small pop-up window when running, is there a way to hide the codes/messages/progress in the display when running it? Or not allowing the pop-up window to appear to the Human User(s) at all?

    Thank you.

    Sunday, July 27, 2014 3:16 AM
  • Then would it be possible whilst logged in through an Administrator account that I insert a code to the batch file which prompts for permission to execute the instructions and saying yes to it automatically but without actually asking for permission from me as the Admin User? Also when I'm running the batch script it's showing its execution process in a small pop-up window when running, is there a way to hide the codes/messages/progress in the display when running it? Or not allowing the pop-up window to appear to the Human User(s) at all?

    Thank you.

    No! Absolutely no way to do this in a script. 

    I think you need to spend some time learning the basics of Windows technology and security.  You just keep asking the same question in different ways.  The answer is no.  Changing the wording of a question won't change reality. 

    UAC cannot be bypassed. It can only be disabled which is never recommended.


    ¯\_(ツ)_/¯


    • Edited by jrv Sunday, July 27, 2014 3:45 AM
    Sunday, July 27, 2014 3:35 AM
  • Your question is in the category of "when people ask for security holes as features."

    If this were possible, it is exactly what malware authors would do.

    Asking the same question a different way will not change the answer.

    You cannot bypass UAC, and this is by design.


    -- Bill Stewart [Bill_Stewart]

    Sunday, July 27, 2014 3:47 AM
  • One possibility is to run the script under the task scheduler.  The prompt is not displayed when running as a task.

    ¯\_(ツ)_/¯

    Sunday, July 27, 2014 3:47 AM
  • An administrator still has to define the task first.


    -- Bill Stewart [Bill_Stewart]

    Sunday, July 27, 2014 11:57 AM
  • An administrator still has to define the task first.


    -- Bill Stewart [Bill_Stewart]


    I agree - the issue is one of design.  Look into how Windows 8 runs maintenance tasks. 

    ¯\_(ツ)_/¯

    Sunday, July 27, 2014 12:04 PM