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;
        }
相关推荐
AI_567820 小时前
SQL性能优化全景指南:从量子执行计划到自适应索引的终极实践
数据库·人工智能·学习·adb
穿过锁扣的风21 小时前
从数据操作到表结构管理:MySQL Shell 与 SQL 核心操作全解析
adb
·云扬·3 天前
MySQL Binlog落盘机制深度解析:性能与安全性的平衡艺术
android·mysql·adb
天马37983 天前
MySql9 免安装版_配置和启动_MySql9安装
adb·mysql9 免安装版·mysql9安装
·云扬·4 天前
MySQL Binlog 配置指南与核心作用解析
数据库·mysql·adb
darling3314 天前
mysql 自动备份以及远程传输脚本,异地备份
android·数据库·mysql·adb
Remember_9934 天前
MySQL 索引详解:从原理到实战优化
java·数据库·mysql·spring·http·adb·面试
多多*5 天前
2月3日面试题整理 字节跳动后端开发相关
android·java·开发语言·网络·jvm·adb·c#
数据蜂巢5 天前
MySQL 8.0 生产环境备份脚本 (Percona XtraBackup 8.0+)
android·mysql·adb
vistaup6 天前
通过ADB 触发gc
adb