Trouble with Process.Start

M

Matt F

I have a relatively command that I'm attempting to get process.start to
execute.

When executing the command, I get a "The system cannot find the file
specified" error. I've gone to the trouble of making sure the entire
command is fully qualified etc. but the error still occurs.

Here is the command (modified slightly of course)
C:\Dev\[solution name]\[project name]\bin\Debug\[exe name to run].exe
/silent /type 1 /constr "Data Source=[sql express instance];Initial
Catalog=[catalog name];Persist Security Info=True;User ID=sa;pwd=[password]"
/destination C:\Dev\[solution name]\[project name]\bin\Debug\Data\[filename]
/destpwd [password]

Note that everything within [] has been modified for post.

Also note: pasting the unaltered version of this to a dos command window
works exactly as I would expect it to.
 
J

Jeffrey Tan[MSFT]

Hi Matt,

Yes, just as Cor pointed out, the other components after the "[exe name to
run].exe" are command line arguments, so they should not be passed as the
"filename" parameter of Process.Start(). There is a overloaded version of
Process.Start(), which takes argumeents as the second parameter:

Public Shared Function Start ( _
fileName As String, _
arguments As String _
) As Process

returnValue = Process.Start(fileName, arguments)

So, You may pass them as the second parameter of Process.Start() method.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Matt F

Cor,

That handled exactly what I need perfectly. Thanks --- I really appreciate
it.
 
M

Matt F

Jeffrey,

I already broke it out in the way that Cor mentioned... but thanks for the
tip -- I'll keep that in mind for future use.
 
J

Jeffrey Tan[MSFT]

You are welcome. If you need further help, please feel free to post, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top