2010-11-24 83 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