2010-11-24 103 views
0

我正在面對一個非常有趣的字符串問題。字符串連接不能正常工作

我的代碼是:

Dim stropt As String 

stropt = " -i ""C:\Rajesh Prj\Video splitter\testvideo.wmv"" -start 00:00:00 -duration 00:00:10 -start 00:00:10 -duration 00:00:10 -sep -o short{000}.wmv" 
'Dim strwithpara As String 
'strwithpara = " -i """ + filepath + """ -start 00:00:00 -duration 00:00:10 -start 00:00:10 -duration 00:00:10 -sep -o short{000}.wmv" 

System.Diagnostics.Process.Start(Environment.CurrentDirectory() + "\asfbin.exe", stropt) 

與上面的代碼它工作正常,但是當我去掉中間的兩條線,它給我:

error: The system cannot find the file specified 

即使我沒有使用可變strwithpara但它在Process.Start中產生了該錯誤。

但是,當我評論這些行(在上面的代碼中未註釋),它的工作正常。 請告訴我我錯過了什麼,並建議我該怎麼做才能解決它。

我在文件對話框的FileName屬性中獲取filepath變量的值。

編輯:我還將變量stroptstrwithpara的值與「IF」條件進行了比較,發現它們是相同的。

+0

我無法與你所提供的代碼來重現問題。對於我的兩條中間線都沒有註釋,它對我來說工作得很好。 – 2010-11-24 12:35:04

回答

0

檢查的Environment.CurrentDirectory() + "\asfbin.exe"stropt使用斷點值,看看它們是否匹配你所期望的

+0

其工作正常時,我的上述2評論評論,但當我讓他們取消評論比它的顯示錯誤。並且我沒有在流程中使用它,所以我無法找到它們之間的關係 – 2010-11-24 12:19:34