使用system.process.start()调用unzip时出错

时间:2014-12-16 20:41:24

标签: c#

有一个奇怪的问题。我有一个C#代码片段,用于Mono的CentOS 6.5机器上的提取自解压.exe:

try
                {
                    //new bash process
                    Process bash = new Process();

                    bash.StartInfo.FileName = "/bin/bash";
                    string command = @"unzip " + Globals.fiberDirectory + @"""" + file + ".exe" + @"""";
                    //Check command string
                    Console.WriteLine(command);
                    bash.StartInfo.Arguments = "-c \" " + command + " \"";
                    bash.StartInfo.UseShellExecute = false;
                    bash.Start();


                }


            catch (Exception e)
            {


                Console.WriteLine("    ...Not Loaded! - " + e.Message);


            }
            finally
            {
            }

输出:

unzip "/home/pan/maps/data/telus/FVData/Fiber/5656 all.exe"


unzip:  cannot find or open /home/pan/maps/data/telus/FVData/Fiber/5656, /home/pan/maps/data/telus/FVData/Fiber/5656.zip or /home/pan/maps/data/telus/FVData/Fiber/5656.ZIP.

当我手动从我的shell运行此命令时:

unzip /home/pan/maps/data/telus/FVData/Fiber/"5656 all.exe"

完美无缺。有什么想法吗?

0 个答案:

没有答案
相关问题