We help IT Professionals succeed at work.
Get Started

Being prompted for logon credentials when launching batch files

Last Modified: 2012-05-09
I have batch files that we need to occasionally run on users' PCs to install programs, fix issues, etc.  The users are only Power Users, so some lines of some of the batch files don't work because of insufficient privileges.  Running EXEs are fine, because I can go Run As.  MSIs are also OK because we deployed a registry fix to add a Run As option to their context menus.  But with Batch we are yet to find a solution.

Logging out and then logging in as admin is not an option.

What would be ideal is if we could place a file (probably a VBS script) in the same directory as the batch, and that it would prompt for username password, then somehow pass those credentials onto the batch file.

If not, is there a way to put some command inside the batch file (and supply credentials in the script) to run parts of the script as admin?  This would then need to be hidden from the user, by encryption or by converting to an EXE or something like that.

I have seen this link below but I don't know how to make it relevant to batch files:


Thanks for your help.
Watch Question
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE