0
我有一個批處理將與一個小腳本如下。現在我想用RUNAS修改它,這樣我就可以爲用戶提供它,而不需要給他管理員密碼。RUNAS引入時批處理文件不會運行
@ECHO OFF
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~xyz0.ps1""' -Verb RunAs}"
PAUSE
我添加RUNAS用幾個參數,如以下所示,但它遇到一個錯誤:
ECHO OFF
runas /profile /user:Administrator /savecred "PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~xyz0.ps1""' -Verb RunAs}""
PAUSE
ERROR:
PS:而不引入RUNAS,所述批處理文件運行得很好。
任何人都可以幫忙。
試過這個,但不幸的是沒有工作。批處理文件打開,閃爍一秒鐘然後消失。 – Vlan007