delphi如何调用执行adb命令?

weige250 2014-11-07 02:38:56
我在delphi里使用如下方法调用adb forward运行程序执行,不起作用,

但是自己在cmd窗口里手动敲出来运行就起作用,使用方法不对吗?

.........

adbpathstr :='C:\software\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.exe';

portnum := '5000';

winexec(pansichar('cmd.exe /c'+ adbpathstr+' forward tcp:'+portnum+' tcp:'+portnum),SW_SHOW);

...............
...全文
390 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weige250 2014-11-12
  • 打赏
  • 举报
回复
搞定,谢谢 adbpathstr :=adbpath.Text; if(length(adbpathstr)=0) then begin showmessage('请指定adb路径'); exit; end; if(length(port.Text)=0) then begin showmessage('请输入端口号'); exit; end; csocket.Port := strtoint(port.Text); portnum :=port.Text; connectstr := adbpathstr+' forward tcp:'+pchar(portnum)+' tcp:'+pchar(portnum); killstr := adbpathstr +' kill-server'; startstr := adbpathstr +' devices'; try FillChar(si,SizeOf(si),0); FillChar(pi,SizeOf(pi),0); si.cb:=SizeOf(si); ProcessFileName:=adbpathstr; CommandLine:=adbpathstr+' forward tcp:'+portnum+' tcp:'+portnum; if CreateProcess(PWideChar(ProcessFileName),PWideChar(CommandLine),nil,nil,False,0,nil,nil,si,pi) then .........
s11ss 2014-11-07
  • 打赏
  • 举报
回复
两个tcp: 5000吗

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧