Solved

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

Posted on 2008-10-28
2
522 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

828 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