2013-10-24 43 views
1

我使用總指揮官打開Windows系統文件夾時遇到了一些問題 當我在cmd中手動運行命令時可以,但是當它作爲ProcessStartInfo不。 這個問題發生在Windows XP上,Windows 7參數(路徑)有點不同,但工作。c#通過總指揮官在C: Windows system32中打開文件夾

  ProcessStartInfo startInfo = new ProcessStartInfo(); //New Proccess 
      startInfo.Arguments = "/L=" + GetArgument(); //Return C:\WINDOWS\system32\config\systemprofile\Local Settings\Application ata\MyApp\update\download [it´s OK] 
      startInfo.WorkingDirectory = Path.GetDirectoryName(GetTcmdPath()); 
      startInfo.FileName = GetTcmdPath(); //returns C:\Program Files\totalcmd\TOTALCMD.EXE [it´s OK] 
      Process.Start(startInfo); //Start proccess 

TC已啓動,但路徑是:C:\ WINDOWS \ system32 \設置\ systemprofile和鴕鳥政策知道爲什麼 任何人可以幫助我嗎?

編輯:當我在cmd中C:\Program Files\totalcmd>TOTALCMD.EXE /L=C:\WINDOWS\system32\config\systemprofile\Local Settings\Application Data\MyApp\update\download運行不"

代替

C:\Program Files\totalcmd>TOTALCMD.EXE /L="C:\WINDOWS\system32\config\systemprofile\Local Settings\Application Data\MyApp\update\download"

it's不工作,但鴕鳥政策知道如何在程序中添加"

回答

0

我發現我的問題的答案,所以如果你需要加雙引號字符串變量的使用是這樣的:

startInfo.Arguments = string.Format("/L=\"{0}\"", GetArgument());

相關問題