-1
我有程序在批處理/ CMD中運行並運行它,我首先必須通過管理員打開cmd,然後打開我的程序。有沒有一種方法可以作爲管理員批處理程序運行而不需要在cmd之前打開管理員身份?如何以管理員身份運行批處理?
我有程序在批處理/ CMD中運行並運行它,我首先必須通過管理員打開cmd,然後打開我的程序。有沒有一種方法可以作爲管理員批處理程序運行而不需要在cmd之前打開管理員身份?如何以管理員身份運行批處理?
你只需要與運行方式運行:
runas /user:administrator myscript.cmd
您可能需要與/savecred
運行它顯然有可以使用的其他開關,所以從CMD線運行runas /?
會給可用的開關。
/noprofile specifies that the user's profile should not be loaded.
This causes the application to load more quickly, but
can cause some applications to malfunction.
/profile specifies that the user's profile should be loaded.
This is the default.
/env to use current environment instead of user's.
/netonly use if the credentials specified are for remote
access only.
/savecred to use credentials previously saved by the user.
/smartcard use if the credentials are to be supplied from a
smartcard.
/user <UserName> should be in form [email protected] or DOMAIN\USER
/showtrustlevels displays the trust levels that can be used as arguments
to /trustlevel.
/trustlevel <Level> should be one of levels enumerated
in /showtrustlevels.
program command line for EXE. See below for examples