找回密码
 加入
搜索
查看: 1340|回复: 4

[网络通信] DOS窗口运行命令行发送密码

[复制链接]
发表于 2021-6-15 16:39:26 | 显示全部楼层 |阅读模式
由于runas在域用户下不稳定,我想模拟dos下操作,下面为代码,但好像测试也是有点问题,怎么判断执行错误?怎么保证用户切换成功?
Local $runas = "runas"
Local $runascs = "/user:admin " & "C:\Windows\notepad.exe"
Global $iPID = ShellExecute($runas, $runascs)
ControlSend($iPID , "", "", "123456{Enter}")

发表于 2021-6-16 22:06:11 | 显示全部楼层
https://www.autoitx.com/Doc/html/functions/runas.htm

示例/演示

; Fill in the username and password appropriate for your system.
Local $sUserName = "Username"
Local $sPassword = "Password"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec, @SystemDir)
 楼主| 发表于 2021-6-17 11:54:32 | 显示全部楼层
eddyyeung 发表于 2021-6-16 22:06
https://www.autoitx.com/Doc/html/functions/runas.htm

示例/演示

好像这个命令不稳定,多数情况下执行出错。不能切换用户过来。
发表于 2021-6-17 22:33:50 | 显示全部楼层
不會吧, 用了好多年了, 詳細說說你的問題
 楼主| 发表于 2021-6-18 10:16:39 | 显示全部楼层
eddyyeung 发表于 2021-6-17 22:33
不會吧, 用了好多年了, 詳細說說你的問題

谢谢你的回答,我再测试看看,如果稳定,我结帖。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-5 02:00 , Processed in 0.072185 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表