第一种方法
RUNAS USAGE:
RUNAS [ [/noprofile | /profile] [/env] [/savecred |
/user:<UserName> program
RUNAS [ [/noprofile | /profile] [/env] [/savecred] ]
/smartcard [/user:<UserName>] program
RUNAS /trustlevel:<TrustLevel> program
/noprofile specifies that the user's profi
This causes the application to
can cause some applications to
/profile specifies that the user's profi
This is the default.
/env to use current environment inst
/netonly use if the credentials specifie
access only.
/savecred to use credentials previously s
This option is not available on
Starter Editions
and will be ignored.
/smartcard use if the credentials are to b
smartcard.
/user <UserName> should be in form US
/showtrustlevels displays the trust levels that
to /trustlevel.
/trustlevel <Level> should be one of levels
in /showtrustlevels.
program command line for EXE. See below
Examples:
> runas /noprofile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %win
> runas /env /user:user@domain.microsoft.com "notepa
NOTE: Enter user's password only when prompted.
NOTE: /profile is not compatible with /netonly.
NOTE: /savecred is not compatible with /smartcard.
举例
runas /user:administrator cmd /c cmd.exe
执行上面的命令有两个前提:
1、设置了administrator的密码
计算机-->管理-->本地用户和组-->administrator->设置密码
2、没有禁用administrator用户
计算机-->管理-->本地用户和组-->administrator-->属性-->常规->勾选掉账户已禁用
第二种方法
为所要运行的命令创建快捷方式,在其属性上勾选run with full permission as an Administrator
第三种方法
直接改变所要运行的.bat或.exe属性