Solved

Problem w/DOS Escape Character ^

Posted on 2004-10-20
4
4,028 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
  • 2
4 Comments
 
LVL 95

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 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now