Solved

VBScript command output stored in return value not piped to file?

Posted on 2008-10-28
2
516 Views
Last Modified: 2012-05-05
I have the following in a VBScript:

strTimeStamp=Year(NOW()) & "-" & Month(NOW()) & "-" & Day(NOW()) & "_" & Hour(NOW()) & "-" & Minute(NOW()) & "-" & Second(NOW())

strCmd=g_strDblQuote & g_strPathToMySQLDump & g_strDblQuote & " --add-drop-table --user=root --password=<password-here> --databases db > " & g_strSavePath & strTimeStamp & ".sql"

which is executed like this:
Set oExecObject = g_oShell.Exec(strCmd)
strReturnedValue=oExecObject.StdOut.ReadAll

for some reason the output is being stored in the variable that holds the return value, not the file specified in the command string. Can anyone tell me why this is and how I can correct it?
0
Comment
Question by:mark_667
  • 2
2 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 125 total points
ID: 22836920
Hi, the pipe output character is not supported unliess you're running the command in a DOS box.  You can change the command from this:

strCmd=g_strDblQuote & g_strPathToMySQLDump & g_strDblQuote & " --add-drop-table --user=root --password=<password-here> --databases db > " & g_strSavePath & strTimeStamp & ".sql"

to this

strCmd="cmd /c " & g_strDblQuote & g_strPathToMySQLDump & g_strDblQuote & " --add-drop-table --user=root --password=<password-here> --databases db > " & g_strSavePath & strTimeStamp & ".sql"

and it should work.

Regards,

Rob.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 22845827
Thanks for the grade.

Regards,

Rob.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now