Ank
Ank

Reputation: 6270

Shell not executing VB.NET

I am trying to execute the shell script in vb.net.

 Shell("C:\Program Files\NCBI\blast-2.2.25+\bin\similarity\blastn -query test.fasta -db database.txt -outfmt 10 -out out.txt")

The script doesn't create the outfile mentioned in -out switch. The path mentioned is correct and also the command with switches is correct. It runs well in command prompt but not in the program.

Thanks


Update

I used process class but still the outfile is not produced.

Imports System.IO
Imports System
Imports System.Diagnostics
Imports System.ComponentModel
Dim myProcess As New Process()
 Try
        myProcess.StartInfo.UseShellExecute = False
        myProcess.StartInfo.WorkingDirectory = "C:\Program Files\NCBI\blast-2.2.25+\bin\similarity\"
        myProcess.StartInfo.FileName = "blastn.exe"
        myProcess.StartInfo.Arguments = "-query test.fasta -db database -outfmt 10 -out out.txt"
        myProcess.StartInfo.CreateNoWindow = True
        myProcess.Start()
    Catch ex As Exception
        MsgBox(ex.Message)
 End Try

Upvotes: 0

Views: 1934

Answers (1)

UnhandledExcepSean
UnhandledExcepSean

Reputation: 12804

Since you haven't specified a path, just a file, it is getting created in whatever working directory you are currently in.

Upvotes: 1

Related Questions