GSM Shop GSM Shop
GSM-Forum  

Welcome to the GSM-Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features.
Only registered members may post questions, contact other members or search our database of over 8 million posts.

Registration is fast, simple and absolutely free so please - Click to REGISTER!

If you have any problems with the registration process or your account login, please contact contact us .

Go Back   GSM-Forum > Other Gsm/Mobile Related Forums > GSM Programming & Reverse Engineering

GSM Programming & Reverse Engineering Here you can post all Kind of GSM Programming and Reverse Engineering tools and Secrets.

Reply
 
LinkBack Thread Tools Display Modes
Old 05-21-2022, 16:47   #1 (permalink)
No Life Poster
 
Join Date: May 2009
Location: USA/NY
Posts: 1,084
Member: 1025079
Status: Offline
Thanks Meter: 307
Donate money to this user
How add multiple ADB commands


I am trying to write small program to read phone info in one click, if I add a second one it only read the first line.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Android_Tool
{
public partial class Form1 : Form
{
private Process process = new Process();
private ProcessStartInfo info = new ProcessStartInfo();
public Form1()
{
InitializeComponent();

info.WindowStyle = ProcessWindowStyle.Hidden;
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
}

private void button1_Click(object sender, EventArgs e)
{
try
{
// Manufactor Model Name //
info.FileName = "adb ";
info.Arguments = "shell getprop ro.product.vendor.manufacturer";


process.StartInfo = info;
process.Start();



richTextBox1.Text = process.StandardOutput.ReadToEnd();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}



}
}
}
  Reply With Quote
Old 06-01-2022, 18:08   #2 (permalink)
Freak Poster
 
Join Date: Oct 2016
Location: Mozambique, Nampula
Posts: 248
Member: 2635974
Status: Offline
Thanks Meter: 44
Donate money to this user
Hello brother, create funcion/class and call it...

in VB you can create function like that:

Function adb(ByVal Arguments As String) As String
Try

Dim My_Process As New Process()
Dim My_Process_Info As New ProcessStartInfo()

My_Process_Info.FileName = "cmd.exe" ' Process filename
My_Process_Info.Arguments = Arguments ' Process arguments
My_Process_Info.WorkingDirectory = "C:\Users\<Your User Name>\AppData\Local\Android\android-sdk\platform-tools" 'this directory can be different in your case.
My_Process_Info.CreateNoWindow = True
My_Process_Info.UseShellExecute = False
My_Process_Info.RedirectStandardOutput = True
My_Process_Info.RedirectStandardError = True
My_Process.EnableRaisingEvents = True
My_Process.StartInfo = My_Process_Info
My_Process.Start()
Dim Process_ErrorOutput As String = My_Process.StandardOutput.ReadToEnd()
Dim Process_StandardOutput As String = My_Process.StandardOutput.ReadToEnd()

If Process_ErrorOutput IsNot Nothing Then Return Process_ErrorOutput
If Process_StandardOutput IsNot Nothing Then Return Process_StandardOutput

Catch ex As Exception
Return ex.Message
End Try

Return "OK"

End Function



And you call it

adb("/c adb cmd0")
adb("/c adb cmd1")
  Reply With Quote
Old 06-02-2022, 15:20   #3 (permalink)
No Life Poster
 
Join Date: May 2009
Location: USA/NY
Posts: 1,084
Member: 1025079
Status: Offline
Thanks Meter: 307
Donate money to this user
Thanks for your reply bro, Will tri that.
  Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 



All times are GMT +1. The time now is 11:46.



Powered by Searchlight © 2022 Axivo Inc.
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2022 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2017 -
Page generated in 0.10162 seconds with 7 queries

SEO by vBSEO