value?(autohotkey v2)
Hello! Try this: #Requires AutoHotkey v2.0 ExecPS(Script, Wait:=true) { shell := ComObject("WScript.Shell") exec := shell.Exec("powershell.exe -Command -") exec.StdIn.Write(Script) exec.StdIn.Close() if Wait return exec.StdOut.ReadAll() } ; Example: ib := InputBox("Enter an expression to evaluate in powershell.",,, 'get-date') if ib.result = "Cancel" return result := ExecPS(ib.value) MsgBox "Result: " result
thx, Get-NetFirewallPortFilter -Protocol UDP | Where-Object { $_.LocalPort -eq 123 } -ErrorAction SilentlyContinue | Select-Object -ExpandProperty LocalPort For example, I want to assign the value obtained by the expression of PowerShell directly to a variable, and then call the variable to determine whether port 123 is open. The pop-up window directly displays whether port 123 is open, instead of directly displaying the result as 123.
Обсуждают сегодня