Windows Vista Forums

output to cmd with | symbol

  1. #1


    Hylle Guest

    output to cmd with | symbol

    Hi.

    I am trying to call a cmd with some parameters. Unfortunately one of
    them is the | symbol.
    Here is the call i make:

    cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status"
    & vbtab & status & vbtab & "Backup completed ok" & chr(124) &
    "files=" & files & ", folders=" & folders &", bytes=" & bytes &
    chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    \send_nsca.cfg"
    wscript.echo cmd

    The call is trying to send input to the send_nsca.exe program, which
    requires TAB as the delimiter, and the chr(124) is the pipe symbol,
    the other pipe sign is working fine. I have tested including the ^
    sign before the chr(124). If i try to enter the command manually on a
    command prompt it works fine, but if it is the vbscript that does it,
    it complains that "files" is not a command. How do I escape the | sign
    so it works?

    Any hints?

    regards

    Jens Hyllegaard

      My System SpecsSystem Spec

  2. #2


    Pegasus [MVP] Guest

    Re: output to cmd with | symbol



    "Hylle" <jens.hyllegaard@newsgroup> wrote in message
    news:2e5512c7-7e24-4223-9a61-d6c6a1f2ac3a@newsgroup

    > Hi.
    >
    > I am trying to call a cmd with some parameters. Unfortunately one of
    > them is the | symbol.
    > Here is the call i make:
    >
    > cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status"
    > & vbtab & status & vbtab & "Backup completed ok" & chr(124) &
    > "files=" & files & ", folders=" & folders &", bytes=" & bytes &
    > chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    > \send_nsca.cfg"
    > wscript.echo cmd
    >
    > The call is trying to send input to the send_nsca.exe program, which
    > requires TAB as the delimiter, and the chr(124) is the pipe symbol,
    > the other pipe sign is working fine. I have tested including the ^
    > sign before the chr(124). If i try to enter the command manually on a
    > command prompt it works fine, but if it is the vbscript that does it,
    > it complains that "files" is not a command. How do I escape the | sign
    > so it works?
    >
    > Any hints?
    >
    > regards
    >
    > Jens Hyllegaard
    Let's have a look at the script line that actually invokes the command!


      My System SpecsSystem Spec

  3. #3


    Tom Lavedas Guest

    Re: output to cmd with | symbol

    On May 25, 10:02*am, Hylle <jens.hyllega...@newsgroup> wrote:

    > Hi.
    >
    > I am trying to call a cmd with some parameters. Unfortunately one of
    > them is the | symbol.
    > Here is the call i make:
    >
    > cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status"
    > & vbtab & status & vbtab & "Backup completed ok" *& chr(124) &
    > "files=" & files & ", folders=" & folders &", bytes=" & bytes &
    > chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    > \send_nsca.cfg"
    > wscript.echo cmd
    >
    > The call is trying to send input to the send_nsca.exe program, which
    > requires TAB as the delimiter, and the chr(124) is the pipe symbol,
    > the other pipe sign is working fine. I have tested including the ^
    > sign before the chr(124). If i try to enter the command manually on a
    > command prompt it works fine, but if it is the vbscript that does it,
    > it complains that "files" is not a command. How do I escape the | sign
    > so it works?
    >
    > Any hints?
    >
    > regards
    >
    > Jens Hyllegaard
    It appears to me that there is a problemwith the two Chr(34)s. They
    are creating an invalid statement. In addition, I found that the
    escape character needs to be escaped, so that it requires THREE carats
    to make the statement work. Try this ...

    cmd="cmd /c" & "Echo WEBTST" & vbtab & "Check Backup status" _
    & vbtab & status & vbtab & "Backup completed ok^^^|" _
    & "files=" & files & ", folders=" & folders &", bytes=" & bytes _
    & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    \send_nsca.cfg"
    wscript.echo cmd
    _____________________
    Tom Lavedas

      My System SpecsSystem Spec

  4. #4


    Hylle Guest

    Re: output to cmd with | symbol

    On 25 Maj, 16:36, "Pegasus [MVP]" <n...@newsgroup> wrote:

    > "Hylle" <jens.hyllega...@newsgroup> wrote in message
    >
    > news:2e5512c7-7e24-4223-9a61-d6c6a1f2ac3a@newsgroup
    >
    >
    >

    > > Hi.
    >

    > > I am trying to call a cmd with some parameters. Unfortunately one of
    > > them is the | symbol.
    > > Here is the call i make:
    >

    > > cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status"
    > > & vbtab & status & vbtab & "Backup completed ok" *& chr(124) &
    > > "files=" & files & ", folders=" & folders &", bytes=" & bytes &
    > > chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    > > \send_nsca.cfg"
    > > wscript.echo cmd
    >

    > > The call is trying to send input to the send_nsca.exe program, which
    > > requires TAB as the delimiter, and the chr(124) is the pipe symbol,
    > > the other pipe sign is working fine. I have tested including the ^
    > > sign before the chr(124). If i try to enter the command manually on a
    > > command prompt it works fine, but if it is the vbscript that does it,
    > > it complains that "files" is not a command. How do I escape the | sign
    > > so it works?
    >

    > > Any hints?
    >

    > > regards
    >

    > > Jens Hyllegaard
    >
    > Let's have a look at the script line that actually invokes the command!
    Sorry, I thought I had put it in.

    here it is, pretty simple:

    result = objShell.run (cmd)

    I then check the value of result

    Regards

    Jens

      My System SpecsSystem Spec

  5. #5


    Hylle Guest

    Re: output to cmd with | symbol

    On 25 Maj, 17:13, Tom Lavedas <tglba...@newsgroup> wrote:

    > On May 25, 10:02*am, Hylle <jens.hyllega...@newsgroup> wrote:
    >
    >
    >

    > > Hi.
    >

    > > I am trying to call a cmd with some parameters. Unfortunately one of
    > > them is the | symbol.
    > > Here is the call i make:
    >

    > > cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status"
    > > & vbtab & status & vbtab & "Backup completed ok" *& chr(124) &
    > > "files=" & files & ", folders=" & folders &", bytes=" & bytes &
    > > chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    > > \send_nsca.cfg"
    > > wscript.echo cmd
    >

    > > The call is trying to send input to the send_nsca.exe program, which
    > > requires TAB as the delimiter, and the chr(124) is the pipe symbol,
    > > the other pipe sign is working fine. I have tested including the ^
    > > sign before the chr(124). If i try to enter the command manually on a
    > > command prompt it works fine, but if it is the vbscript that does it,
    > > it complains that "files" is not a command. How do I escape the | sign
    > > so it works?
    >

    > > Any hints?
    >

    > > regards
    >

    > > Jens Hyllegaard
    >
    > It appears to me that there is a problemwith the two Chr(34)s. *They
    > are creating an invalid statement. *In addition, I found that the
    > escape character needs to be escaped, so that it requires THREE carats
    > to make the statement work. *Try this ...
    >
    > cmd="cmd /c" & "Echo WEBTST" & vbtab & "Check Backup status" _
    > & vbtab & status & vbtab & "Backup completed ok^^^|" _
    > & "files=" & files & ", folders=" & folders &", bytes=" & bytes _
    > & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    > \send_nsca.cfg"
    > wscript.echo cmd
    > _____________________
    > Tom Lavedas
    Hi.

    Thanks that did it. It was due to the triple ^

    Here is what is working for me now.

    cmd="cmd /c" & chr(34) & "Echo WEBTST" & vbtab & "Check Backup status"
    & vbtab & status & vbtab & "Backup completed ok^^^" & chr(124) &
    "files=" & files & ", folders=" & folders &", bytes=" & bytes &
    chr(34) & "|c:\repbcklog\send_nsca.exe -H nagios2 -c C:\repbcklog
    \send_nsca.cfg"
    test = objShell.run (cmd)
    wscript.echo cmd

      My System SpecsSystem Spec

output to cmd with | symbol

Similar Threads
Thread Forum
@ symbol won't work
Hello, Lately my @ symbol won't work so I can't type out new emails!!! I can reply but can't create new ones. It's only in this email...
Vista mail
Re: Why does the > symbol appear on some replies but not on others?
Windows Mail, and its predecessor OE, is unable to indent quoted text with the > character if the post being quoted used MIME/ Quoted-Printable...
Vista mail
Re: Why does the > symbol appear on some replies but not on others?
If you are paying $20 for your service (the organization in you message says "NewsGuy - Unlimited Usenet $19.95") then you are not getting a good...
Vista mail
Symbol definition
In the message list, the bar across the top is an (!) exclaimation point. What is it for and what can I do with it?
Vista mail
Office Symbol
momentan sieht man bei einigen Kontakten das Office symbol unterhalb von dem anzeigebild neben der camera weiƟ jemand was das zu bedeuteten hat...
Live Messenger
Calendar Symbol
Is there any way to make it easier to get to the calendar in windows mail? Or, can you put a button on the bottom like in outlook?
Vista mail
Euro symbol
I am nog able to find the euro symbol in Windows Mail. In Office (and Outlook) it is working with ctrl + alt + 5 but not in Windows Mail. Neither...
Vista mail