Solved

How to call .exe from .Net ?

Posted on 2014-09-29
2
185 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
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now