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
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
"Luka1993" <Luka1993@xxxxxx> wrote in message
news:0B171216-562C-4037-9276-F096917C7523@xxxxxxTry:
> 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
--
Luka1993 wrote:hi Luka1993,
> 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)
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
> 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
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Send command line via WMI - Pipe output to text file on remote mac | Ripp | PowerShell | 20 | 26 Sep 2008 |
| Re: Send command line via WMI - Pipe output to text file on remote | Shay Levy [MVP] | PowerShell | 0 | 26 Sep 2008 |
| Suppress output from a command line tool | Chris Harris | PowerShell | 6 | 23 May 2007 |
| MS-DOS program starts only in full screen mode from command line | =?Utf-8?B?SnVlcmdlbiBHYXU=?= | Vista General | 0 | 29 Aug 2006 |
| Output Event Log From Command Line | =?Utf-8?B?c2VucmFiZGV0?= | Vista General | 4 | 14 Aug 2006 |