How to execute a windows batch as admin

Hi, I need to execute an application that opens CMD.exe as a basic user, what I need is to execute the command as an administrator.
is there a way I can create a batch file to execute the app as admin?
atorexAsked:
Who is Participating?
 
omgangConnect With a Mentor IT ManagerCommented:
wshshell.run runas /user:administrator "c:\apps\POSTouch.exe, 0, TRUE"

You may need to experiment with how to pass the arguments
OM Gang
0
 
omgangIT ManagerCommented:
Runas command may be what you're looking for.

From a command line type
runas /?
for details

in your batch file you could have
Rem run as admin
runas /user:localmachine\administrator "c:\path\MyApp.exe"

You'll receive a prompt for the administrator password.
There's no way (that I know of) to embed the password in the batch file.  This can be done via script, however.
OM Gang
0
 
atorexAuthor Commented:
Yes you are correct, what I need is runas.
can runas be used with aoutostart?
0
 
omgangIT ManagerCommented:
autostart?  Not sure I understand.
OM Gang
0
 
atorexAuthor Commented:
dim wshshell
set wshshell = wscript.createobject("wscript.shell")
wshshell.run "c:\apps\POSTouch.exe", 0, TRUE



I have something like the above, can I pass user and password with the above?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.