-5

ループを指すボタンをクリックするたびにプログラムがクラッシュします。これが指すコードのスニペットは次のとおりです。

  Public Function ExecuteCommand(ByVal filePath As String, ByVal arguments As String)     As String
        Dim p As Process
        p = New Process()
        p.StartInfo.FileName = filePath
        p.StartInfo.Arguments = arguments
        p.StartInfo.CreateNoWindow = True
        p.StartInfo.UseShellExecute = False
        p.StartInfo.RedirectStandardOutput = True
        p.Start()  // points to this line
        Return p.StandardOutput.ReadToEnd()
    End Function

エラーは、「System.dll で「System.ComponenetModel.Win32Exception」タイプの未処理の例外が発生しました。

追加情報: 指定されたファイルが見つかりません

どんな助けでも大歓迎です。ありがとう。

4

1 に答える 1

0

提供された実行可能ファイルがFileNameディスク上に存在しないことは明らかです。

実行する前に、その存在を確認することをお勧めします。

于 2014-05-07T17:35:15.337 に答える