473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Process.Start vs. Command line syntax

I'm trying to programatically run an app.
The command line syntax is:
"C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt
and it works as intended.
In code, I have this
Dim myProc As Process = New Process()

myProc.StartInfo.FileName = "C:\Program Files\WinSCP3\WinSCP3.exe"
I've also tried """C:\Program Files\WinSCP3\WinSCP3.exe"""

myProc.StartInfo.Arguments = "-script=myscript.txt"

myProc.Start()

This doesn't work and doesn't produce an error.

What am I doing wrong?

thanks

Kevin Vogler
Aug 29 '08 #1
7 2073
On Aug 29, 11:59 pm, "Kevin Vogler" <kvog...@phoenixgrouppos.com>
wrote:
I'm trying to programatically run an app.
The command line syntax is:
"C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt
and it works as intended.

In code, I have this
Dim myProc As Process = New Process()

myProc.StartInfo.FileName = "C:\Program Files\WinSCP3\WinSCP3.exe"
I've also tried """C:\Program Files\WinSCP3\WinSCP3.exe"""

myProc.StartInfo.Arguments = "-script=myscript.txt"

myProc.Start()

This doesn't work and doesn't produce an error.

What am I doing wrong?

thanks

Kevin Vogler
Try this:

Dim p As New Process
Dim info As New ProcessStartInfo _
("C:\Program Files\WinSCP3\WinSCP3.exe", _
"-script=myscript.txt")
p.Start(info)
Hope it works,

Onur Güzel
Aug 29 '08 #2
Process.Start("C:\Program Files\WinSCP3\WinSCP3.exe",
"-script=myscript.txt")

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:81**********************************@k37g2000 hsf.googlegroups.com...
On Aug 29, 11:59 pm, "Kevin Vogler" <kvog...@phoenixgrouppos.com>
wrote:
>I'm trying to programatically run an app.
The command line syntax is:
"C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt
and it works as intended.

In code, I have this
Dim myProc As Process = New Process()

myProc.StartInfo.FileName = "C:\Program Files\WinSCP3\WinSCP3.exe"
I've also tried """C:\Program Files\WinSCP3\WinSCP3.exe"""

myProc.StartInfo.Arguments = "-script=myscript.txt"

myProc.Start()

This doesn't work and doesn't produce an error.

What am I doing wrong?

thanks

Kevin Vogler

Try this:

Dim p As New Process
Dim info As New ProcessStartInfo _
("C:\Program Files\WinSCP3\WinSCP3.exe", _
"-script=myscript.txt")
p.Start(info)
Hope it works,

Onur Güzel
Aug 29 '08 #3
Thanks for the quick response.

That doesn't work also.

Maybe I've got this screwed up.

I've been running the command line from the Run command not a terminal
window. Does that make a difference.

Thanks
Kevin
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:81**********************************@k37g2000 hsf.googlegroups.com...
On Aug 29, 11:59 pm, "Kevin Vogler" <kvog...@phoenixgrouppos.com>
wrote:
I'm trying to programatically run an app.
The command line syntax is:
"C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt
and it works as intended.

In code, I have this
Dim myProc As Process = New Process()

myProc.StartInfo.FileName = "C:\Program Files\WinSCP3\WinSCP3.exe"
I've also tried """C:\Program Files\WinSCP3\WinSCP3.exe"""

myProc.StartInfo.Arguments = "-script=myscript.txt"

myProc.Start()

This doesn't work and doesn't produce an error.

What am I doing wrong?

thanks

Kevin Vogler
Try this:

Dim p As New Process
Dim info As New ProcessStartInfo _
("C:\Program Files\WinSCP3\WinSCP3.exe", _
"-script=myscript.txt")
p.Start(info)
Hope it works,

Onur Güzel
Aug 29 '08 #4
Kevin Vogler wrote:
I'm trying to programatically run an app.
The command line syntax is:
"C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt
and it works as intended.
In code, I have this
Dim myProc As Process = New Process()

myProc.StartInfo.FileName = "C:\Program Files\WinSCP3\WinSCP3.exe"
I've also tried """C:\Program Files\WinSCP3\WinSCP3.exe"""

myProc.StartInfo.Arguments = "-script=myscript.txt"

myProc.Start()

This doesn't work and doesn't produce an error.

What am I doing wrong?

thanks

Kevin Vogler
What do you mean when you say that it "doesn't work"? What happens, and
how does that differ from what you expect?

--
Göran Andersson
_____
http://www.guffa.com
Aug 30 '08 #5
Thanks for the response.
When I put that command in Start/Run it runs a script that places a file in
a folder via SFTP.

When I put that command in a sub in a vb.net windows app and run it, nothing
happens. No file, no errors thrown.

At this point the myscript.txt file is in the same directory as the
WinSCP3.exe. Do I have to give the absolute path to the myscript.txt since
my app is now running out of my debug folder of my windows app as opposed to
program I'm calling?

I can't try this at the moment because I'm not in the office.

Thanks
Kevin Vogler

"Göran Andersson" <gu***@guffa.comwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Kevin Vogler wrote:
>I'm trying to programatically run an app.
The command line syntax is:
"C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt
and it works as intended.
In code, I have this
Dim myProc As Process = New Process()

myProc.StartInfo.FileName = "C:\Program Files\WinSCP3\WinSCP3.exe" I've
also tried """C:\Program Files\WinSCP3\WinSCP3.exe"""

myProc.StartInfo.Arguments = "-script=myscript.txt"

myProc.Start()

This doesn't work and doesn't produce an error.

What am I doing wrong?

thanks

Kevin Vogler

What do you mean when you say that it "doesn't work"? What happens, and
how does that differ from what you expect?

--
Göran Andersson
_____
http://www.guffa.com

Aug 30 '08 #6
Kevin Vogler wrote:
I'm trying to programatically run an app.
From where? What /sort/ of process?
The command line syntax is:
"C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt
and it works as intended.
In code, I have this
Dim myProc As Process = New Process()
myProc.StartInfo.FileName = "C:\Program Files\WinSCP3\WinSCP3.exe"
I've also tried """C:\Program Files\WinSCP3\WinSCP3.exe"""
You don't need the quotes - the ProcessStartInfo class will take care of
those for you.
myProc.StartInfo.Arguments = "-script=myscript.txt"
myProc.Start()
Where does that /script/ live? How is WinScp3.exe supposed to find it?

Try setting the .WorkingDirectory property as well (to the directory in
which the script resides).
This doesn't work and doesn't produce an error.
If Process.Start couldn't find the .exe, you'd get an error all
right(!), so that bit /must/ be working; I suspect it's just that the
..exe can't find the script.

HTH,
Phill W.
Sep 2 '08 #7
Phil,

Thanks the response. It clarified a few things for me. Part of my problem
was the syntax for a console window vs. the Run dialog. Once I sorted it out
in the console window, I was able to get things to work in code.

Thanks again,

Kevin Vogler
Sep 2 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ryan Walker | last post by:
Hi, I'm getting started with python and have almost zero programming experience. I'm finding that there are tons of tutorials on the internet -- such as the standard tutorial at python.org -- that...
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
10
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
10
by: Tony | last post by:
I am running an application called AcroComm.exe to poll time clocks here at our company. I have written a small C# app that will poll the clocks based on information found in a DB. My problem is...
6
by: danl | last post by:
I need to be able to execute a .bat file from a C# web application I have the following code that compliles and seems to run fine, but the bat file never does it's work...
0
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a...
7
by: WALDO | last post by:
I wrote a console application that basically consumes arguments and starts other command line apps via System.Process. Let's call it XCompile for now. I wrote a Visual basic add-in that does pretty...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a C# application in which I start another process which produces output to stdout and stderr. In fact, that process is the uSoft VS2005 C/C++ compiler itself! I would like to...
12
by: =?Utf-8?B?ZXAu?= | last post by:
What is preferred method to start an app process and then fill in form fields? The following prog does not compile (b/c AppActivate does not have the correct param):...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.