加上A大的那个可以运行啊,编译后也可以,试试我这个最简单的dism命令行不行#RequireAdmin
#include <AutoItConstants.au3>
$cmd = "dism /?"
$result = RunCmd($cmd, False, True)
MsgBox(0, "", $result)
Func RunCmd($sCommand, $bBin = False, $bWait = False)
;1:要执行的命令行(无需带@ComSpec) 2:是否以二进制方式读取(防止中文乱码,如ImageX) 3:是否等待进程执行完毕(防止部分exe数据流获取不全,如Diskpart)
If $bBin Then
Local $sOutput = Binary('')
Else
Local $sOutput = ''
EndIf
Local $iPID = Run($sCommand, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
If $bWait Then
ProcessWaitClose($iPID)
$sOutput = StdoutRead($iPID, False, $bBin)
Else
While 1
$sOutput &= StdoutRead($iPID, False, $bBin)
If @error Then ExitLoop
WEnd
EndIf
If $bBin Then $sOutput = BinaryToString($sOutput, 4)
Return $sOutput
EndFunc ;==>RunCmd
|