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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:54:00+00:00 2026-06-12T15:54:00+00:00

The below script works on Windows XP as expected. The script abc.bat would run

  • 0

The below script works on Windows XP as expected. The script abc.bat would run as Administrator without a prompt for password(password is supplied automatically). But the same script is not working on our Windows 7 Box. Are there any changes required? I have no experience with VB Scripting. Thanks!

Option Explicit

Const USER               = "administrator"
Const PASS               = "*********"
Const WSNAME_COMMANDLINE = "C:\support\abc.bat"

Dim fso         : Set fso = CreateObject("Scripting.FileSystemObject")
Dim WSHShell    : Set WshShell = CreateObject("WScript.Shell")
Dim WshNetwork  : Set WshNetwork = CreateObject("WScript.Network")
Dim oDic        : Set oDic = CreateObject("Scripting.Dictionary")
Dim objArgs     : Set objArgs = WScript.Arguments
Dim oProcessEnv : Set oProcessEnv = WshShell.Environment("PROCESS")

Dim sPathToRunAs, iReturnCode

sPathToRunAs = oProcessEnv("SystemRoot")&"\System32\runas.exe"
''msgbox sPathtorunas

if Not fso.FileExists(sPathToRunAs) Then : WScript.Quit(1) 'Can't find RunAs

'''msgbox "runas /user:" & USER & " " & CHR(34) & WSNAME_COMMANDLINE & CHR(34)
iReturnCode=WshShell.Run("runas /user:" & USER & " " & CHR(34) & WSNAME_COMMANDLINE & CHR(34), 2, FALSE)

Wscript.Sleep 40                  ' Time for window to open.
WshShell.AppActivate(sPathToRunAs)' Activate the Window
Wscript.Sleep 3
WSHShell.SendKeys PASS & "~"      ' Send the password
Wscript.Sleep 3

''msgbox "done"
  • 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-12T15:54:01+00:00Added an answer on June 12, 2026 at 3:54 pm

    Did you try the script on Windows 7 with UAC (User Account Control) disabled?

    You can find a howto on disabling UAC here: http://windows.microsoft.com/en-US/windows-vista/Turn-User-Account-Control-on-or-off

    If UAC is the reason for your issue, you may use windows task scheduler to avoid this like it is explained here: http://poundcomment.wordpress.com/2011/03/18/how-to-create-a-whitelist-uac-for-windows-7/

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

Sidebar

Related Questions

It's my first time dealing with cookies in JavaScript and the below script works
The script below works fine if 3 and 3.2 are not links but i
The following script works fine: $(#regform).validate().showErrors({username:message}); After I changed the script to the below
I tested out the script below in jsfiddle and it works fine, can someone
The jQuery ajax script below doesn't work on my site if url is without
i am trying to run the below script SELECT field_value FROM jos_js_res_record_values jrv INNER
How would I change the below script to edit the original file instead of
If I run the wget command listed below in the script by itself on
Below, I have a java script function (named stateChange) which is expected to update
I wrote a simple python script using the SocketServer, it works well on Windows,

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.