![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | how to log output from a command line program Hi! It is very simple to do it with batch for example: cmdprogram.exe > log.txt i tried it with vbscript but i dont know what im doing wrong.... objShell.Run """" & sScriptPath & "\cmdprogram.exe" > "log.txt" & """", vbhide |
My System Specs![]() |
| | #2 (permalink) |
| | Re: how to log output from a command line program "Luka1993" <Luka1993@xxxxxx> wrote in message news:0B171216-562C-4037-9276-F096917C7523@xxxxxx Quote: > Hi! > > It is very simple to do it with batch > for example: > cmdprogram.exe > log.txt > > i tried it with vbscript but i dont know what im doing wrong.... > > objShell.Run """" & sScriptPath & "\cmdprogram.exe" > "log.txt" & """", > vbhide ====== strCmd = "%comspec% /c """ & sScriptPath & "\cmdprogram.exe"" > log.txt" objShell.Run strCmd, 0, True ====== You can echo the value assigned to strCmd to make sure it looks correct. Any quotes embedded in a quoted string need to be doubled. If a string ends with a trailing quote, you get 3 quotes. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: how to log output from a command line program Luka1993 wrote: Quote: > i tried it with vbscript but i dont know what im doing wrong.... > > objShell.Run """" & sScriptPath & "\cmdprogram.exe" > "log.txt" & """", vbhide Try this: oShell.Run """" & sScriptPath & "\cmdprogram.exe" & """" & " > log.txt" There is another suggestion, if you want to be a little more sophisticated. Read up on the WScript.Shell object's Exec Method, and how one would retrieve the StdOut property. The benefit of StdOut is that you can have the app's output coming back to your script either character-by-character, or line-by-line. This may or nay not be of value, but in some situations -- such as pinging another server -- it allows for taking some alternative logic path depending on the output, as it is occurring. cheers, jw ____________________________________________________________ You got questions? WE GOT ANSWERS!!! ..(but, no guarantee the answers will be applicable to the questions) |
My System Specs![]() |
| | #4 (permalink) |
| | Re: how to log output from a command line program Hello, Try this (the > is now inside of the quotes): objShell.Run """" & sScriptPath & "\cmdprogram.exe > log.txt" & """", vbhide Otherwise, are you getting any specific error message or just a syntax error? -B "Luka1993" <Luka1993@xxxxxx> wrote in message news:0B171216-562C-4037-9276-F096917C7523@xxxxxx Quote: > Hi! > > It is very simple to do it with batch > for example: > cmdprogram.exe > log.txt > > i tried it with vbscript but i dont know what im doing wrong.... > > objShell.Run """" & sScriptPath & "\cmdprogram.exe" > "log.txt" & """", > vbhide |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Send command line via WMI - Pipe output to text file on remote mac | PowerShell | |||
| Re: Send command line via WMI - Pipe output to text file on remote | PowerShell | |||
| Suppress output from a command line tool | PowerShell | |||
| MS-DOS program starts only in full screen mode from command line | Vista General | |||
| Output Event Log From Command Line | Vista General | |||