Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 12th, 2006, 07:55 PM
Registered User
 
Join Date: Aug 2003
Location: Zion, IL, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to wslyhbb Send a message via MSN to wslyhbb Send a message via Yahoo to wslyhbb
Default Process problem

I am trying to execute a command line program from within C# and direct the output to a file.
ProcessStartInfo commandPrompt = new ProcessStartInfo("cmd.exe");

commandPrompt.Arguments = "/c " + @"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe" + " -u user -pPassword database > " + @"C:\backup\database.sql";

Process backup = Process.Start(commandPrompt);

However, it creates C:\backup\database.sql, but the file is 0 bytes and nothing is written to the file. If I execute mysqldump -u user -pPassword database > C:\backup\database.sql the file is 24KB and contians the correct output.

My question, if someone can help me, is why the output is not actually being directed to the file?
Reply With Quote
  #2 (permalink)  
Old February 13th, 2006, 10:12 PM
Registered User
 
Join Date: Aug 2003
Location: Zion, IL, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to wslyhbb Send a message via MSN to wslyhbb Send a message via Yahoo to wslyhbb
Default

I figured it out. I redirected the error out to a file and then looked at it, found that because the path has a space in it and was not quoted it could not find "C:\Program".
Reply With Quote
  #3 (permalink)  
Old February 14th, 2006, 12:48 AM
Registered User
 
Join Date: May 2005
Location: chennai, tamil nadu, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Elamparithi.c Send a message via Yahoo to Elamparithi.c
Default

using this command
isqlw.exe -U userid -P password -d databasename -S servername
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with process.. nelly78 .NET Framework 2.0 3 October 14th, 2008 05:54 AM
process.startinfo opens new instance of process Anypond General .NET 0 August 28th, 2008 05:35 AM
Problem with CPU time in killing process Samatha General .NET 0 December 14th, 2006 05:37 AM
Process.Kill() online problem kool_creative General .NET 3 October 29th, 2006 11:07 PM
have problem with diagnostics.process methods octopus Pro VB.NET 2002/2003 0 December 19th, 2003 03:49 AM



All times are GMT -4. The time now is 10:07 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.