I have tried
Code: Select all
MsgBox % ComObjCreate("WScript.Shell").Exec("powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -noProfile -nologo dir").StdOut.ReadAll()
Code: Select all
MsgBox % ComObjCreate("WScript.Shell").Exec("powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -noProfile -nologo dir").StdOut.ReadAll()
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
psex := "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -noProfile -nologo dir"
#Include stdout2var.ahk
msgbox % StdOutStream(psex)
Code: Select all
#Requires AutoHotkey v2.0
#Include stdout2var_v2.ahk
MsgBox StdOutStream('powershell.exe -command "echo `'Hello Привет`'"', 'cp866')