Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 12th, 2006, 08:55 PM
Registered User
 
Join Date: Aug 2003
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?
 
Old February 13th, 2006, 11:12 PM
Registered User
 
Join Date: Aug 2003
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".
 
Old February 14th, 2006, 01:48 AM
Registered User
 
Join Date: May 2005
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





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 06:37 AM
Process.Kill() online problem kool_creative General .NET 3 October 30th, 2006 12:07 AM
have problem with diagnostics.process methods octopus Pro VB.NET 2002/2003 0 December 19th, 2003 04:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.