Tu t'es compliqué la vie avec tes chaînes. C'est pas plutôt ça que tu veux :
Code : Tout sélectionner
local $hFile="infos.txt"
$CMD = _
'arp -a && ' & _
'net view && ' & _
'route print && ' & _
'net share && ' & _
'net localgroup && ' & _
'net use && ' & _
'tasklist /svc && ' & _
'wmic useraccount list && ' & _
'gpresult /SCOPE COMPUTER /Z'
$foo = Run(@ComSpec & " /c " & $CMD, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
ProcessWaitClose($foo)
$Text = StdoutRead($foo)
FileWrite($hFile, $Text)
ShellExecuteWait($hFile)
Tu aurais même intérêt à convertir le texte capturé si la console DOS est paramétrée comme par défaut (jeu OEM) :
Code : Tout sélectionner
...
$Text = StdoutRead($foo)
$Text = _CodepageToStr($Text)
FileDelete($hFile) ; si on ne veut pas risquer l'accumulation de texte.
FileWrite($hFile, $Text)
ShellExecuteWait($hFile)
Func _CodepageToStr($sCP, $iCodepage = Default)
If $iCodepage = Default Then $iCodepage = Int(RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Nls\Codepage", "OEMCP"))
Local $tText = DllStructCreate("byte[" & StringLen($sCP) & "]")
DllStructSetData($tText, 1, $sCP)
Local $aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", StringLen($sCP), _
"ptr", 0, "int", 0)
Local $tWstr = DllStructCreate("wchar[" & $aResult[0] & "]")
$aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $iCodepage, "dword", 0, "struct*", $tText, "int", StringLen($sCP), _
"struct*", $tWstr, "int", $aResult[0])
Return DllStructGetData($tWstr, 1)
EndFunc ;==>_CodepageToStr
La cryptographie d'aujourd'hui c'est le taquin plus l'électricité.