fybhwsx 发表于 2026-3-2 22:17:37

【已解决】碰到一个命令回显问题,求助!

本帖最后由 fybhwsx 于 2026-3-3 14:21 编辑

下面这个命令始终获取不了执行结果?!
Local $iPid = Run(@ComSpec & " /c uwfmgr.exe get-config", '', @SW_HIDE, 0x8)
ProcessWaitClose($iPid)
Local $sInfo = BinaryToString(StdoutRead($iPid, 1, 1), 1)
MsgBox(0, "", $sInfo)编码问题,最后一个参数改为2就好了。Local $sInfo = BinaryToString(StdoutRead($iPid, 1, 1), 2)


fybhwsx 发表于 2026-3-2 22:18:51

cmd窗口运行uwfmgr.exe get-config没有问题。。

gyp2000 发表于 2026-3-2 22:51:04

fybhwsx 发表于 2026-3-2 22:18
cmd窗口运行uwfmgr.exe get-config没有问题。。

直接使用RUN函数 执行uwfmgr.exe 不需要调用CMD。

fybhwsx 发表于 2026-3-2 22:56:15

gyp2000 发表于 2026-3-2 22:51
直接使用RUN函数 执行uwfmgr.exe 不需要调用CMD。

Local $iPid = Run('uwfmgr.exe get-config', '', @SW_HIDE, 0x8)
这样吗,也不行。

gyp2000 发表于 2026-3-2 23:58:15

fybhwsx 发表于 2026-3-2 22:56
Local $iPid = Run('uwfmgr.exe get-config', '', @SW_HIDE, 0x8)
这样吗,也不行。

大概又是遇到64位程序的问题了,将autoit配置为64位编译目标程序。
Uwfmgr 位于 %WINDIR%\System32\ 文件夹下

#AutoIt3Wrapper_UseX64=y
If Not FileExists(@SystemDir & "\uwfmgr.exe") Then Exit MsgBox(0, "错误", "uwfmgr.exe 文件不存在")
Local $iPid = Run(@SystemDir & "\uwfmgr.exe get-config", '', @SW_HIDE, 0x6)
ProcessWaitClose($iPid)
Local $sInfo = BinaryToString(StdoutRead($iPid, 1, 1), 1)
MsgBox(0, "", $sInfo)

fybhwsx 发表于 2026-3-3 08:29:31

本帖最后由 fybhwsx 于 2026-3-3 08:32 编辑

gyp2000 发表于 2026-3-2 23:58
大概又是遇到64位程序的问题了,将autoit配置为64位编译目标程序。
Uwfmgr 位于 %WINDIR%\System32\ 文件 ...
还是不行,和前面的代码返回结果一样:邁,就一个这样的字?

我直接带上程序路径Local $iPid = Run('C:\Windows\System32\uwfmgr.exe get-config', '', @SW_HIDE, 0x8)返回结果也是上面那个字。

gyp2000 发表于 2026-3-3 11:35:33

可能返回的二进制数据流并不是ANSI编码的字符串。
你可以将二进制数据流当UTF8方式解码。
页: [1]
查看完整版本: 【已解决】碰到一个命令回显问题,求助!