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 9141003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:35:24+00:00 2026-06-17T09:35:24+00:00

I have a small vbs script: Set UAC = CreateObject(Shell.Application) UAC.ShellExecute C:\bin\addtopath.bat, chr(34) &

  • 0

I have a small vbs script:

Set UAC = CreateObject("Shell.Application")
UAC.ShellExecute "C:\bin\addtopath.bat",  chr(34) & "C:\bin" & chr(34), "", "runas", 1

C:\bin\addtopath.bat exists and I took some idea from this question. What happens here is that a cmd opens and instantly closes and I’m not able to identify what it says. How do I know what is wrong?

C:\bin\addtopath.bat:

pause
echo %1
pause
:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0",  chr(34) ^& %1 ^& chr(34), "", "runas", 1 >> "%temp%\getadmin.vbs"
    pause
    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------
echo %1
pause
setenv -a PATH %1

pause
  • 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-17T09:35:25+00:00Added an answer on June 17, 2026 at 9:35 am

    What are you invoking a batch file? Why don’t you just do everything in VBSCRIPT?

    Debugging your vbscript can be done with a debugger by using the /D /X parameters

        cscript /d /x file.vbs
        wscript /d /x file.vbs
    

    Debugging batch files is a nightmare. Here is some help for debugging batch files:
    http://www.robvanderwoude.com/battech_debugging.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here I have a small VBS script that helps me append a new line
I have small script in bash, which is generating graphs via gnuplot. Everything works
I have small question. When I started to programm my application, I grouped types
I have small python script in which I look for a pattern in the
I have small application that is uploading pictures to another website via webservice. My
I have small application using JSF 1.1. It is using NTLM for authentication. What
I have small TFTP server running on port 8080. It is an Android application.
A little back story : I have small application that will use Word to
I have small application on Rails 2.3.2, served with nginx+thin(127). OS FreeBSD 7.1, DB
I have small chess application which consists of cells and boards. When user moves

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.