Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Пользователь


Сообщения: 86
Благодарности: 2

Профиль | Отправить PM | Цитировать


Прошло 5лет и я нашел баг в своем посте

вот рабочий вариант

Код: Выделить весь код
#include <Constants.au3>
#include <Encoding.au3>



Func _power($comand)

	local $PowerShell = Run(@ComSpec & " /c powershell " & $comand, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	local $out="", $err=""
	StdinWrite($PowerShell)
	While 1
		$line = StdoutRead($PowerShell)
		If @error Then ExitLoop
		If $line <> "" Then $out&=_Encoding_OEM2ANSI($line)
	Wend


	if $out="" then
		$out=""
		While 1
			$err = StderrRead($PowerShell)
			If @error Then ExitLoop
			If $err <> "" Then $out&=_Encoding_OEM2ANSI($err)

		Wend
	endif

	If $PowerShell Then ProcessClose($PowerShell)
	if $out <> "" then Return $out

EndFunc

Отправлено: 19:05, 21-10-2014 | #11