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;
        }
相关推荐
不愿透露姓名的大鹏21 小时前
MySQL慢查询日志实战优化指南
linux·服务器·数据库·mysql·adb
半条-咸鱼2 天前
如何通过 ADB 连接安卓设备(USB + 无线 TCP/IP)
android·adb
路baby2 天前
Pikachu安装过程中常见问题(apache和MySQL无法正常启动)
计算机网络·mysql·网络安全·adb·靶场·apache·pikachu
XDHCOM2 天前
MySQL ER_IB_MSG_919报错解析,故障修复与远程处理指南
数据库·mysql·adb
今天又在写代码3 天前
数据智能分析平台部署
adb
今天又在写代码3 天前
数据智能分析平台部署服务器
android·服务器·adb
不愿透露姓名的大鹏3 天前
MySQL Binlog配置优化全攻略
运维·服务器·数据库·mysql·adb
禹中一只鱼3 天前
【ADB 关键命令与配置速查笔记】(自用复盘版)
笔记·adb
姚永强4 天前
dns实验
adb
RInk7oBjo4 天前
MySQL的编译安装
数据库·mysql·adb