Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8992777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:02:19+00:00 2026-06-15T23:02:19+00:00

I created a batch to run specific commands, the code looks like this: cd

  • 0

I created a batch to run specific commands, the code looks like this:

cd  D:\projects\Project Stress Test\signed one\com0com\x64
setupc
pause

what i want is to run the setupc file as an admin?

i tried runas /user:<Name>\administrator commands but it didnt work.

is there any easy way to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:02:20+00:00Added an answer on June 15, 2026 at 11:02 pm

    You could make the entire script run at admin level. Here is a batch function I use in my scripts.

    @echo off
    call :Admin xReturn true 1
    echo.%xReturn%
    goto End
    
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :Admin <Return> [Needed] [Success]
    :: Check for Administrator privileges and request privileges if needed.
    :: NOTE: This will restart the script with Admin privs if Needed is set to true.
    :::: Usage: call :Admin xReturn true
    :: Return success value, if user is Admin. Default `true` if Success not set.
    setlocal
    set xVBUAC=%Temp%\AdminUAC.vbs
    set xSuccess=true
    if not "%~3"=="" set xSuccess=%~3
    
    :: Check for Access
    ::net session >nul 2>&1
    >nul 2>&1 "%SystemRoot%\system32\cacls.exe" "%SystemRoot%\system32\config\system"
    if %ErrorLevel% EQU 0 set xAdmin=%xSuccess%
    
    :: Execute UAC
    if /i not "%xAdmin%"=="%xSuccess%" if not "%~2"=="" if /i "%~2"=="true" (
      echo Set UAC = CreateObject^("Shell.Application"^) > "%xVBUAC%"
        echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%xVBUAC%"
        if exist "%xVBUAC%" (
            "%xVBUAC%"
            rem if %ErrorLevel% EQU 5 echo Access Denied. Launching UAC.
            del "%xVBUAC%"
        )
    )
    endlocal & if not "%~1"=="" set "%~1=%xAdmin%"
    goto :eof
    
    :End
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a script to run a test script on a batch of
I have created a batch file to execute 10 commands at one time as
I've created a one-line batch file to run SqlMetal to regenerate a LINQ to
I would like to get the source code of a project at specific time
I created a batch file to run SqlMetal and generate Linq2Sql data classes, check
What I would like I would like to easily run a batch file without
Problem Summary When run in batch mode, my user identity is lost but (like
I created an application in Excel VBA that needs to run a batch file
I have created a batch file for ex(ex.bat) Is it possible to run batch
i have created a batch file and have added it to the project using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.