John
2005-09-13 21:35:41 UTC
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
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