字符串连接无法正常工作

时间:2010-11-24 12:11:46

标签: vb.net string

我正面临着一个非常有趣的字符串问题。

我的代码是:

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中生成了该错误。

但是当我评论这些行(在上面的代码中没有注释)时,它的工作正常。 请告诉我我缺少的东西,并告诉我应该怎么做才能解决它。

我从文件对话框的filepath属性FileName变量中获取值。

编辑:我还将变量stroptstrwithpara的值与“IF”条件进行了比较,发现它们是相同的。

1 个答案:

答案 0 :(得分:0)

使用断点检查Environment.CurrentDirectory() + "\asfbin.exe"stropt的值,看看它们是否符合您的预期