Shell Experts PLEASE

Discussion in 'Scripting' started by John, Sep 13, 2005.

  1. John

    John Guest

    Hi guys

    I have a program and does stdout a mix of characters.

    When I created a simple program to test the types of characters I noticed
    that the windows shell didn’t handle well the output

    The sample program is the one below



    echo off

    REM the var variable is an example of what the program stdouts

    set var=Status: Interface Down 100%: IF-TESTSQL01/65539 [Intel 21140-Based
    PCI Fast Ethernet Adapter (Generic)] [10.255.255.152]


    REM here I capture the STDOUT to another variable called Out
    REM if the for /f line doesn’t run then program bop_cmd program will not
    complete

    for /f "Tokens=*" %%a in ('bop_cmd -f c:\gencr.frg "gencr("""%var%""",
    """%CIID%""","""""","""""", """""", """""","""""", """""", """""","""""",
    """""", """%SM_OBJ_Severity%""", """INCIDENT""")"') do set Out=%%a


    REM here I just try to echo out the information and this is the stdout I get

    echo %var%


    C:\>testvar.bat REM name of simple batch to test

    C:\>echo off
    ] was unexpected at this time.
    C:\>

    Any help on how I can escape characters or wrap them in such a way that it
    will not stop the script from running the next line
     
    John, Sep 13, 2005
    #1
    1. Advertisements

  2. John

    sameersalve Guest

    I know its a very long time that you had posted this.
    Have you done any scripting to open tickets using cmd line into ca service desk ?

    -Sameer
     
    sameersalve, Mar 2, 2013
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.