比如我的腳本路徑:C:\script\psfile.ps1
管理員運行powershell來執行psfile.ps1,命令如下:
powershell -noprofile -command "&{ start-process powershell -ArgumentList '-noprofile -file C:\script\psfile.ps1' -verb RunAs}"
該命令用CMD或Powershell 均可執行
比如我的腳本路徑:C:\script\psfile.ps1
管理員運行powershell來執行psfile.ps1,命令如下:
powershell -noprofile -command "&{ start-process powershell -ArgumentList '-noprofile -file C:\script\psfile.ps1' -verb RunAs}"
該命令用CMD或Powershell 均可執行
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。