วันศุกร์ที่ 18 กันยายน พ.ศ. 2558

multiple cmd adb java call andriod shell ,AWK cmnd


======================
รูปแบบ 
D:\YumYumAndroidTool>(
More?    echo cd sdcard
More?    echo ls
More? ) | adb shell
===================
เราสร้าง ไฟล์ 
D:\YumYumAndroidTool>echo cd sdcard > cmd.txt

D:\YumYumAndroidTool>echo ls -l >> cmd.txt

D:\YumYumAndroidTool>adb shell < cmd.txt
adb shell < cmd.txt
========================
adb shell "cd sdcard;ls -l"
======================


===for dos shell and  bat file
cmd /c "echo foo & echo bar"
D:\YumYumAndroidTool>cmd /c "echo foo & echo bar"
foo
bar


============for dos
cmd /? ดู help
---------------

D:\YumYumAndroidTool>cmd /c if exist abc. (rd /q abc) & echo hello
hello
ถ้า dir abc มี ให้ลบ แลว ทำคำสั่ง echo hello
--------------
echo netsh dump ^&^& pause ^&^& exit>foobar.cmd && start "" /w foobar.cmd && del foobar.cmd
---------------
cmd /c %1 
cmd /c %2 
สร้าง ไฟล์ bat ใสคำสั่งบน เพื่อให้มัน รันทีละคำสั่ง
bat "dir /w" "pause"

----------
Command A & Command B
Execute Command A, then execute Command B (no evaluation of anything)

Command A | Command B
Execute Command A, and redirect all its output into the input of Command B

Command A && Command B
Execute Command A, evaluate the errorlevel after running and if the exit code (errorlevel) is 0, only then execute Command B

Command A || Command B
Execute Command A, evaluate the exit code of this command and if it's anything but 0, only then execute Command B

Using multiple commands and conditional processing symbols
You can run multiple commands from a single command line or script using conditional processing symbols. When you run multiple commands with conditional processing symbols, the commands to the right of the conditional processing symbol act based upon the results of the command to the left of the conditional processing symbol.
For example, you might want to run a command only if the previous command fails. Or, you might want to run a command only if the previous command is successful.
You can use the special characters listed in the following table to pass multiple commands.
& [...] command1 & command2 Use to separate multiple commands on one command line. Cmd.exe runs the first command, and then the second command.
&& [...] command1 && command2 Use to run the command following && only if the command preceding the symbol is successful. Cmd.exe runs the first command, and then runs the second command only if the first command completed successfully.
|| [...] command1 || command2 Use to run the command following || only if the command preceding || fails. Cmd.exe runs the first command, and then runs the second command only if the first command did not complete successfully (receives an error code greater than zero).
( ) [...] (command1 & command2) Use to group or nest multiple commands.
; or , command1 parameter1;parameter2 Use to separate command parameters.
========================

ไม่มีความคิดเห็น:

แสดงความคิดเห็น