cmd - How to run Batch as admin? -


this question has answer here:

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

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -