cmd - How to run Batch as admin? -
this question has answer here:
- how code bat file run admin mode? 7 answers
i have programm running in batch/cmd , run first have open cmd via admin, open programm. there way run admin batch program without openning before cmd admin ?
you need run runas:
runas /user:administrator myscript.cmd you might need run /savecred
obviously there other switches can used, running runas /? cmd line give available switches.
/noprofile specifies user's profile should not loaded. causes application load more quickly, can cause applications malfunction. /profile specifies user's profile should loaded. default. /env use current environment instead of user's. /netonly use if credentials specified remote access only. /savecred use credentials saved user. /smartcard use if credentials supplied smartcard. /user <username> should in form user@domain or domain\user /showtrustlevels displays trust levels can used arguments /trustlevel. /trustlevel <level> should 1 of levels enumerated in /showtrustlevels. program command line exe. see below examples
Comments
Post a Comment