adb push有中文名的文件到sdcard

正常我们

adb push xxxx /sdcard/即可

但如果有中文则要加上双引号

adb push "c:\\这是中文.jpg" "/sdcard/这是中文.jpg"

同样 adb pull也是一样的

adb pull "/sdcard/这是中文.jpg" "c:\\这是中文.jpg"

不用大费周章的去同改adb 的代码,加上双引号就好了!

c# 在执行中增加

psi.StandardOutputEncoding = Encoding.UTF8;

psi.StandardErrorEncoding = Encoding.UTF8;

可对中文进行捕获

复制代码
public static String run_process_without_window(String path, String arg, int time_wait_for_exit = 10000, bool forceDisconnect = false)
        {
            string output = "";
            try
            {
                if (forceDisconnect == false)
                {
                    if (arg.IndexOf("disconnect") != -1)
                    {
                        return arg;
                    }
                }
          
                System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@path, @arg);

                psi.CreateNoWindow = true; // 不创建新窗口
                psi.RedirectStandardOutput = true;
                psi.RedirectStandardError = true;  // 重定向错误输出
                psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

                psi.UseShellExecute = false;
                psi.StandardOutputEncoding = Encoding.UTF8;
                psi.StandardErrorEncoding = Encoding.UTF8;

                System.Diagnostics.Process listFiles;

                listFiles = System.Diagnostics.Process.Start(psi);

                System.IO.StreamReader myOutput = listFiles.StandardOutput;
                System.IO.StreamReader myerrOrput = listFiles.StandardError;
                listFiles.WaitForExit(time_wait_for_exit);
                
                if (listFiles.HasExited)
                {
                    output = myOutput.ReadToEnd() + "\r\n" + myerrOrput.ReadToEnd();
                }
            }
            catch(Exception)
            {
                 
            }
            return output;
        }
相关推荐
活宝小娜12 天前
mysql详细安装教程
数据库·mysql·adb
zhangjin112012 天前
adb install和 pm install 的区别是什么?
adb
炼川淬海DB13 天前
数据库开发规范
android·adb·数据库开发
何极光13 天前
MySQL 8.0详细安装教程(附下载地址)
数据库·mysql·adb
sevencheng79814 天前
【ADB】adb命令行常用按键模拟代码
linux·adb·模拟按键,返回键,音量键
QX_hao14 天前
mysqldump-vs-xtrabackup
adb·mysql备份
云计算磊哥@15 天前
运维开发宝典028-MySQL04数据库热备
数据库·adb·运维开发
charlee4415 天前
Unity在安卓端如何调试输出信息
android·unity·adb·游戏引擎·真机调试
ai_coder_ai16 天前
如何使用adb实现自动化脚本?
运维·adb·自动化
pigs201816 天前
mysql8.0 access denied for user root localhost account is locked
数据库·adb