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;
        }
相关推荐
北极糊的狐30 分钟前
MySQL常见报错分析及解决方案总结(30)---MySQL Error 1025(Error on rename)
adb
南棱笑笑生3 小时前
20251211给飞凌OK3588-C开发板适配Rockchip原厂的Buildroot【linux-6.1】系统时适配adb【type-C0】
linux·c语言·adb·rockchip
ZePingPingZe4 小时前
Spring Boot + MySQL读写分离实现方案
spring boot·mysql·adb
qq_2153978975 小时前
shell 脚本部署docker 服务MySQL 5.7
mysql·adb·docker
soft20015257 小时前
Linux + MySQL + Sysbench 一键部署和压测教程
linux·mysql·adb
The star"'19 小时前
mysql(4-7)
数据库·mysql·adb
Yao_YongChao1 天前
adb wifi连接Android手机
android·adb·智能手机·无线连接手机·wifi连接手机
数据库知识分享者小北1 天前
Dify+ADB Supabase+LLM 实现 AI 客服系统
数据库·人工智能·阿里云·adb·postgresql
元气满满-樱1 天前
MySql源码安装
数据库·mysql·adb
R.lin2 天前
windows MySQL解压版安装教程
windows·mysql·adb