有一个奇怪的问题。我有一个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"
完美无缺。有什么想法吗?