?
Solved

Problem w/DOS Escape Character ^

Posted on 2004-10-20
4
Medium Priority
?
4,040 Views
Last Modified: 2012-06-21
I have the following script; all lines print to the output file except for the Prompt19 line and I don't understand why.

REM Put currentDate into YYYY-MM-DD format
REM Put firstDayOfMonth into YYYY-MM-DD format
REM Put currentYear into YYYY format
for /F "tokens=2-4 delims=/ " %%A in ('date/T') do (
    set currentDate=%%C-%%A-%%B
    set firstDayOfMonth=%%C-%%A-01
    set currentYear=%%C
)

REM Put currentMonth in MMM format
REM http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_21174359.html#12352023
for /f "tokens=2 delims=/ " %%a in ('date /t') do (
    if "%%a" == "1" set currentMonth=JAN
    if "%%a" == "2" set currentMonth=FEB
    if "%%a" == "3" set currentMonth=MAR
    if "%%a" == "4" set currentMonth=APR
    if "%%a" == "5" set currentMonth=MAY
    if "%%a" == "6" set currentMonth=JUN
    if "%%a" == "7" set currentMonth=JUL
    if "%%a" == "8" set currentMonth=AUG
    if "%%a" == "9" set currentMonth=SEP
    if "%%a" == "10" set currentMonth=OCT
    if "%%a" == "11" set currentMonth=NOV
    if "%%a" == "12" set currentMonth=DEC
)


REM Use the ^ character to allow the | to be written to the output file.
REM http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_21173759.html

cd d:\impromptu\reprunner

echo [Catalog]>>hnb_monthly_reprunner.ini
echo catalog1 = d:\impromptu\catalog\new_mts_11.cat>>hnb_monthly_reprunner.ini
echo catname1 = user>>hnb_monthly_reprunner.ini
echo catpwd1 = >>hnb_monthly_reprunner.ini
echo dbname1 = rgw_user>>hnb_monthly_reprunner.ini
echo dbpwd1 = intranet>>hnb_monthly_reprunner.ini
echo [Daily Reports]>>hnb_monthly_reprunner.ini
echo Report1=d:\impromptu\bin\accounting.imr>>hnb_monthly_reprunner.ini
echo Prompt1=%currentDate%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report2=d:\impromptu\bin\canceled_messages.imr>>hnb_monthly_reprunner.ini
echo Prompt2=%currentDate%>>hnb_monthly_reprunner.ini
echo Report3=d:\impromptu\bin\credit_party_not-on-file.imr>>hnb_monthly_reprunner.ini
echo Prompt3=%currentMonth%^|%currentYear%>>hnb_monthly_reprunner.ini
echo Report4=d:\impromptu\bin\fed_transaction_journal.imr>>hnb_monthly_reprunner.ini
echo Prompt4=%currentDate%>>hnb_monthly_reprunner.ini
echo Report5=d:\impromptu\bin\general_ledger_transaction.imr>>hnb_monthly_reprunner.ini
echo Prompt5=%currentDate%>>hnb_monthly_reprunner.ini
echo Report6=d:\impromptu\bin\general_ledger_transaction_cmln.imr>>hnb_monthly_reprunner.ini
echo Prompt6=%currentDate%>>hnb_monthly_reprunner.ini
echo Report7=d:\impromptu\bin\operator_file_change.imr>>hnb_monthly_reprunner.ini
echo Prompt7=%currentDate%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report8=d:\impromptu\bin\operator_inactivity.imr>>hnb_monthly_reprunner.ini
echo Prompt8=15>>hnb_monthly_reprunner.ini
echo Report9=d:\impromptu\bin\operator_statistics.imr>>hnb_monthly_reprunner.ini
echo Prompt9=%currentDate%>>hnb_monthly_reprunner.ini
echo Report10=d:\impromptu\bin\party_not_on_file.imr>>hnb_monthly_reprunner.ini
echo Prompt10=%firstDayOfMonth%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report11=d:\impromptu\bin\pin_expiration.imr>>hnb_monthly_reprunner.ini
echo Prompt11=2000-01-01^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report12=d:\impromptu\bin\pin_file_change.imr>>hnb_monthly_reprunner.ini
echo Prompt12=%currentDate%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report13=d:\impromptu\bin\skip_transaction.imr>>hnb_monthly_reprunner.ini
echo Prompt13=%currentDate%>>hnb_monthly_reprunner.ini
echo Report14=d:\impromptu\bin\stop_action_statistics.imr>>hnb_monthly_reprunner.ini
echo Prompt14=%currentDate%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report15=d:\impromptu\bin\stop_transaction.imr>>hnb_monthly_reprunner.ini
echo Prompt15=%currentDate%>>hnb_monthly_reprunner.ini
echo Report16=d:\impromptu\bin\straight_through.imr>>hnb_monthly_reprunner.ini
echo Prompt16=%currentDate%^|ALL>>hnb_monthly_reprunner.ini
echo Report17=d:\impromptu\bin\swf_daily_inbound_message_type.imr>>hnb_monthly_reprunner.ini
echo Prompt17=%currentDate%>>hnb_monthly_reprunner.ini
echo Report18=d:\impromptu\bin\swf_daily_outbound_message_type.imr>>hnb_monthly_reprunner.ini
echo Prompt18=%currentDate%>>hnb_monthly_reprunner.ini
echo Report19=d:\impromptu\bin\unacknowledged_pin.imr>>hnb_monthly_reprunner.ini
echo Prompt19=ALL^|2003-01-01^|%currentDate%^|ALL^|0>>hnb_monthly_reprunner.ini
echo Report20=d:\impromptu\bin\general_ledger_12001050204.IMR>>hnb_monthly_reprunner.ini
echo Prompt20=%currentDate%>>hnb_monthly_reprunner.ini
echo Report21=d:\impromptu\bin\general_ledger_13000050204.IMR>>hnb_monthly_reprunner.ini
echo Prompt21=%currentDate%>>hnb_monthly_reprunner.ini
echo Report22=d:\impromptu\bin\relationship_file_change.imr>>hnb_monthly_reprunner.ini
echo Prompt22=%currentDate%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report23=d:\impromptu\bin\repetitive_file_change.imr>>hnb_monthly_reprunner.ini
echo Prompt23=%currentDate%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report24=d:\impromptu\bin\standing_order_file_change.imr>>hnb_monthly_reprunner.ini
echo Prompt24=%currentDate%^|%currentDate%>>hnb_monthly_reprunner.ini
echo Report25=d:\impromptu\bin\large_dollar_customer_usage.imr>>hnb_monthly_reprunner.ini
echo Prompt25=%currentDate%^|500000>>hnb_monthly_reprunner.ini
0
Comment
Question by:jasonboetcher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 12357572
I just cut and past your exact line and didn't have a problem with it.  Try as a single line and see if it works for you.
0
 

Author Comment

by:jasonboetcher
ID: 12357704
I did the echo as a line command and it works as well; try pasting it into a .bat file and running it and look at the output.  The line in question is missing.
0
 
LVL 5

Accepted Solution

by:
brianadkins earned 1000 total points
ID: 12357794

try this...

(another way to deal with problems echoing to a text file)

>>hnb_monthly_reprunner.ini echo Prompt19=ALL^|2003-01-01^|%currentDate%^|ALL^|0

-Brian
0
 

Author Comment

by:jasonboetcher
ID: 12357889
I'm not sure I understand why this works but it does; thanks!
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question