?
Solved

How to call .exe from .Net ?

Posted on 2014-09-29
2
Medium Priority
?
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
chaau earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

762 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