We help IT Professionals succeed at work.

Execute .exe and pass variables from vb.net webpage button click event

I have an .exe file that decrypts some .dat files. From a button click event I need to call this exe and pass the following variable string to it:

C:\inetpub\wwwroot\bin\sddebug.exe -i <txtPath.text & "\SnapDriveInfo\*.dat"> -o <txtPath.text & "\SnapDriveInfo\">

Can someone help me with this?
Comment
Watch Question

Technology Development Consultant
CERTIFIED EXPERT
Commented:
on button click event you have to write...
System.Diagnostics.ProcessStartInfo processstart = new System.Diagnostics.ProcessStartInfo(@"C:\inetpub\wwwroot\bin\sddebug.exe","-i <txtPath.text & \"\SnapDriveInfo\*.dat\"> -o <txtPath.text & \"\SnapDriveInfo\">");
            System.Diagnostics.Process.Start(processstart);

Open in new window

Author

Commented:
Thanks. You put me on the right path. I ended up with this:

  Dim filepath As String = txtPath.Text & "\SnapDriveInfo\"
            Dim dbgFiles As String() = IO.Directory.GetFiles(filepath)
            Dim datFiles = From p In dbgFiles Where p.Contains(".dat") Select p

            For Each File In datFiles
                Dim sourceFile As String = File
                Dim fileName As String = IO.Path.GetFileName(sourceFile)
                Dim destFile As String = fileName.Replace(".dat", ".log")
                Dim p As New ProcessStartInfo
                p.FileName = "D:\sddbglog.exe"
                p.Arguments = " -i " & sourceFile & " -o " & txtPath.Text & "\SnapDriveInfo\Debug\" & destFile
                Process.Start(p)
            Next

Open in new window

Explore More ContentExplore courses, solutions, and other research materials related to this topic.