[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Problem w/DOS Escape Character ^

Posted on 2004-10-20
4
Medium Priority
?
4,044 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 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