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;
        }
相关推荐
独行soc8 小时前
2025年渗透测试面试题总结-106(题目+回答)
网络·python·安全·web安全·adb·渗透测试·安全狮
撩得Android一次心动12 小时前
Android adb 基础使用指南
android·adb
xiyangyang811012 小时前
ubantu的adb命令(首次安装adb)
adb
此生只爱蛋18 小时前
mysql_store_result
android·adb
川石课堂软件测试1 天前
全链路Controller压测负载均衡
android·运维·开发语言·python·mysql·adb·负载均衡
独行soc2 天前
2025年渗透测试面试题总结-105(题目+回答)
网络·python·安全·web安全·adb·渗透测试·安全狮
九皇叔叔2 天前
Docker 镜像维护指南:从配置优化到 MySQL 实战运行
mysql·adb·docker
muxin-始终如一2 天前
MySQL分区分表实现方法详解
数据库·mysql·adb
2501_929382653 天前
电视盒子助手开心电视助手 v8.0 删除电视内置软件 电视远程控制ADB去除电视广告
android·windows·adb·开源软件·电视盒子
和计算机搏斗的每一天3 天前
mysqlAB复制
adb