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;
        }
相关推荐
ayaya_mana44 分钟前
MySQL忘记Root密码,详细找回密码步骤
数据库·mysql·adb
Jtti3 小时前
如何通过检查MySQL与系统日志以找出服务器CPU占用源
服务器·mysql·adb
Solar20251 天前
MySQL安装避坑指南:从下载到启动的全平台避坑手册
adb
黄思搏1 天前
Python + ADB 手机自动化控制教程
python·adb
曾凡宇先生4 天前
无法远程连接 MySQL
android·开发语言·数据库·sql·tcp/ip·mysql·adb
独行soc4 天前
2025年渗透测试面试题总结-215(题目+回答)
网络·安全·web安全·adb·渗透测试·1024程序员节·安全狮
我科绝伦(Huanhuan Zhou)5 天前
MySQL一键升级脚本(5.7-8.0)
android·mysql·adb
玩机达人885 天前
2025年新版ADB工具箱下载+驱动+ADB指令集+fastboot刷机ROOT工具
adb
czhc11400756635 天前
Linux1023 mysql 修改密码等
android·mysql·adb
QT 小鲜肉6 天前
【个人成长笔记】在本地Windows系统中如何正确使用adb pull命令,把Linux系统中的文件或文件夹复制到本地中(亲测有效)
linux·windows·笔记·学习·adb