
批處理如何實現域管理員運行軟件最后由 aitest 于 -11-8 15:58目的:制作成bat,封裝管理員密碼,轉成exe。發給域用戶臨時安裝軟件使用方向:域用戶一健完成安裝
- @echo off
- start /wait D:ET64Everything.exe
- RunAsAdmin()
- Func RunAsAdmin()
- Local $sUserName = *
- Local $sPassword = *
- Local $DOMAIN = *
- Local $pid = RunAs($sUserName,$DOMAIN,$sPassword,0,Everything.exe,D:ET64Everything.exe,@SW_HIDE)
- EndFunc
nclick="copycode($('code0'));">復制代碼
程序可以啟動安裝界面,域管理員權限不生效。試過@echo offrunas user:* D:ET64Everything.exe程序啟動安裝,cmd提示需要輸入密碼 ,微軟bat不支持裝入密碼。請問怎么解決?最后找到一段:set WshShell = Ws
cript.CreateObject(Ws
cript.Shell) WshShell.run runas /user:test %comspec% ,,Open command prom
ptWs
cript.Sleep 1000WshShell.SendKeys 111111 send password WshShell.SendKeys{ENTER}Ws
cript.Sleep 1000,,open ETWsheShell.SendKeys Chr(34) + D:EverythingEverything.exe + Chr(34)WsheShell.SendKeys {ENTER}WsheShell.SendKeys exit ,,Close command prom
pt WsheShell.SendKeys {ENTER}還是不行,請問哪里錯了?