Solved

Problem w/DOS Escape Character ^

Posted on 2004-10-20
4
4,032 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Bulk File Rename 3 128
How to Skip in FOR command if a Directory does not exist. 6 87
Batch to Restart Remote Computers 4 96
Running Visio Macro from VBS File 3 91
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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