Neko Posted December 14, 2008 Posted December 14, 2008 I want to execute a command in VB.NET. When I type this command in a dos-window, it works fine. When I execute exactly the same command in VB, it does NOT work. I can NOT debug because than I get an error (Can't find the command). When executing the command, I can see a dos-window open and disappear, but it is too fast to see anything. How do I solve this? Dim objProcess As New Process() objProcess.StartInfo.WorkingDirectory = strCommandoLokatie objProcess.StartInfo.FileName = strCommando objProcess.StartInfo.Arguments = txtDatabase.Text & " -u " & txtUser.Text & " -p" & txtPassword.Text & " > " & strOutputLokatie & "\Dump" & txtDatabase.Text & IIf(chkData.Checked, "", "NoData") & ".sql" objProcess.Start() objProcess.Dispose() Arguments = "klapper -u root -p**** > C:\temp\Dumpklapper.sql" FileName = "MySqlDump.exe" WorkingDirectory = "C:\Program Files\MySQL\MySQL Server 5.0\bin" **** is the real pasword when I run. Quote
Nate Bross Posted December 15, 2008 Posted December 15, 2008 Have you tried using the pause command? Try writing all your exact commands to a script.bat file and then use your VB Net to call said bat file. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
MrPaul Posted December 15, 2008 Posted December 15, 2008 Redirect the output using .NET Redirection using > is a function of the Windows shell interpreter. To get this to work you would need to launch cmd.exe directly (or via a batch file as Nate suggests). A better solution would be to capture the output of the MySqlDump.exe process and write it to a file. The following thread shows how to do this: Redirect Standard Output of a Process with window hidden? [C# 2002] Good luck :cool: Quote Never trouble another for what you can do for yourself.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.