Solved

Problem w/DOS Escape Character ^

Posted on 2004-10-20
4
4,027 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
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
I'm not sure I understand why this works but it does; thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

7 Experts available now in Live!

Get 1:1 Help Now