Solved

How to call .exe from .Net ?

Posted on 2014-09-29
2
188 Views
Last Modified: 2014-09-30
I have to call sfxcl.exe from vb.net by passing paramters. Below syntax works well for .bat file. If i use .bat file instead of .exe , by mentioning the syntax of .exe inside the .bat works fine.

From proc.StartInfo.Arguements, I am getting as

D:/Test.csv,sftp://username:pwd@hostname:22//home/foldera/

Open in new window

But i am expecting as

"D:/Test.csv" sftp://username:pwd@hostname:22//home/foldera/

Open in new window


This syntax works well for batch file execution. Batch file execution takes place in the hidden scenario.
I am trying to have the same feature in the .exe file execution.


 Dim sSFTP As String = String.Empty
            sSFTP = "sftp://" & strUserName & ":" & strPassword & "@" & strHostName & ":" & iPort & strDestPath

            Dim strBatchFile As String = String.Empty
            strBatchFile = "C:\Program Files (x86)\VanDyke Software\Clients\sfxcl.exe"

            Dim proc As New System.Diagnostics.Process()
            proc.StartInfo.UseShellExecute = False
            proc.StartInfo.FileName = strBatchFile
            proc.StartInfo.Arguments = String.Format("{0},{1}", strSourceFile, sSFTP)
            proc.StartInfo.CreateNoWindow = True
            proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
            proc.Start()

Open in new window

0
Comment
Question by:chokka
2 Comments
 
LVL 24

Accepted Solution

by:
chaau earned 500 total points
ID: 40351204
Use this syntax for the Arguments:
 proc.StartInfo.Arguments = String.Format("""{0}"" {1}", strSourceFile, sSFTP)

Open in new window

0
 

Author Closing Comment

by:chokka
ID: 40352152
Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question