回复 31# hnfeng
根据你的建议,我修改了一下,密码为空的情况依然无法检测出来,依然只能检测密码错误的时候cmd窗口信息,研究不透了。
- #include <Constants.au3>
- $GUICtrlRead2 = ""
- $foom = Run(@ComSpec & " /c (for /f ""tokens=*"" %i in ('sqlcmd -U sa -P " & $GUICtrlRead2 & "') do @echo %i) ", @SystemDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)
- ProcessWaitClose($foom)
- $Textm = StdoutRead($foom)
- If StringInStr($Textm, "登录失败") Then
- MsgBox(16, "密码错误", "密码错误", "")
- ElseIf StringInStr($Textm, "参数") Then
- MsgBox(16, "密码错误", "没输入密码", "")
- Else
- MsgBox(16, "密码正确", "SQL Server数据库sa账户密码正确!", "")
- EndIf
复制代码 |