Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
depends what you mean by use ASCII code.
If you want to echo an ASCII key thats not on
the keyboard, you could use...
echo [followerd by holding the [ALT] down and entering it's ASCII number on the Numeric Keypad.

Thanks for help dtech.
I want to echo an ASCII key which is not on the keyboard. (CR) ASCII 13. It works when I type it at the command line, but not in a batchfile.
Tried to save it as unicode also.I need it for string substitution.
uli

Hi uli,
I don't quite get the idea of the echo working at the prompt but not in a BAT.
Can you post exact results, like this:
::== uli.bat
@echo offecho £
::== DONEC:\temp\-\bigger>echo £
£C:\temp\-\bigger>uli
£And it would help to know what you are trying to do.
"I need it for string substitution."
Can you explain that?
If at first you don't succeed, you're about average.M2

Sorry for giving less information.
I have a huge textfile like this:uli::glueck[BR]ritchie::blackmore[BR]....
([BR] means the html tag)
I want to format it like:uli::glueck
ritchie::blackmore
....I found out now how to substitiute the [BR]
against a Carriage Return:set end=%var:[BR]=&echo.%
Works, but not when html tags are in the textfile.
I get a CMD.exe error when I try to parse the textfile with a for loop.
'the instruction in "0x013799da" refers to memory in "0x00000000"
read couldn't complete at the memory"'my code:
for /f %%A in ('type c:\test.txt') do call :SUB %%A
goto :EOF
:SUB %%A
set var=%1
set var=%var:[BR]=&echo.%echo %var%
Just using type or find at the commandline works.
I don't have any idea what to do.
Uli

Hi uli,
I think it will take IVO or somebody smarter than me to do this with a BAT.
What I do is use a 3rd party 'find & replace' utility.
For files up to 30KB:
Since you said the file is huge, you need:
If at first you don't succeed, you're about average.M2

Hi again,
Note that those utilities are DOS utils, so the file to be handled must conform to 8.3 naming.
Here's a BAT I wrote which temporarily renmes the file to change. I think you get the idea.
::==
:maindir /b *.html > htmlLIST
for /f "tokens=*" %%H in (htmlLIST) do call :sub1 %%H
cls
goto :eof:sub1
ren "%1" "workFILE"
change.com workFILE "www.microsoft.com" "www.apple.com"
ren "workFILE" "%1"
goto :eof
:: DONE
If at first you don't succeed, you're about average.M2

Hi M2,
many thanks for your help.
I found the problem.
I tried a textfile with a few lines only and had the same effect.
1.
The lines are to long to get them in a variable.
(This crashes my cmd)2.
Cause of the HTML-Tags I need double quotes for setting the variable.
Thats why I can't substitute the string in the variable with &echo. It isn`t recognized as a command.I fear to solve this problem is over my head.
Do you have an idea how to fix this problem?I try to avoid 3rd party tools. If there is no way I can try it with sed.
uli

Problem 2 is solved: :-)set var="uli[br]glueck"
set var=%var:[br]=#~#%
set var=%var:"=%
set var=%var:#~#=^&echo.%
echo %var%uli

Hi uli
If you don't need the quotes, this would be shorter.@echo off
set var=uli[br]glueck
set var=%var:[br]=^&echo.%
echo %var%

Hi dtech,
thanks.
I need the double quotes cause of the html tag in the variable.
Otherwise I get the errormessage
"System can't find the file".The code looks a bit circular. I know.
uli

Hi uli
A bit shorter but not much.@echo off
set var="uli[br]glueck"
rem remove quotes
set var=%var:"=%
rem change [br] to CR
set var=%var:[br]=^&echo.%
echo %var%

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |