随笔 - 224  文章 - 41  trackbacks - 0
<2010年9月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

享受编程

常用链接

留言簿(11)

随笔分类(159)

随笔档案(224)

文章分类(2)

文章档案(4)

经典c++博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜

        public static void Dex2Jar(string dexPath)
        
{
            Process p 
= new Process();
            p.StartInfo.FileName 
= "cmd.exe ";
            p.StartInfo.UseShellExecute 
= false;
            p.StartInfo.RedirectStandardInput 
= true;
            p.StartInfo.RedirectStandardOutput 
= true;
            p.StartInfo.RedirectStandardError 
= true;
            p.StartInfo.CreateNoWindow 
= true;
            p.Start();
            
string cmd = Application.StartupPath;
            cmd 
= @"cd /d " + cmd;
            p.StandardInput.WriteLine(cmd);
            cmd 
= "\"" + Application.StartupPath + "\\""dex2jar.bat" + "\" " + "\"" + dexPath + "classes.dex" + "\"";
            
if ((Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major >= 6))
            
{
                cmd 
= Application.StartupPath + "\\" + "dex2jar.bat" + " " + dexPath + "classes.dex";
            }

            
            p.StandardInput.WriteLine(cmd);
            p.StandardInput.WriteLine(
"exit");

            
//string strOutput = null;
            
//strOutput = p.StandardOutput.ReadToEnd();
            
//Console.WriteLine(strOutput);
            p.WaitForExit();
            p.Close();
        }


ps:不知道什么原因,批处理命令的调用在xp和win7下的调用参数有点不同,多了一个引号参数。
posted on 2010-08-29 11:03 漂漂 阅读(5240) 评论(0)  编辑 收藏 引用 所属分类: c#开发

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理