Link to home
Start Free TrialLog in
Avatar of amendala
amendala

asked on

Inserting an ASCII symbol into a command line string from a batch file

Greetings all -

I'm in a quandry here... I'm not sure how to deal with this.

I've got a textual search and replace command that takes this syntax:
searchandreplace [find string] [replace with string] [filename]

My problem is that the [find string] I want to specify has a copyright symbol in it (the ASCII version, not the textual (C) version).

My issue is that when I cut and paste the command from my batch file onto the command line and run it, the copyright symbol works.  If I run the command from a batch file, it shows up as a goofy other symbol when executed.  I"m assuming this has something to do with the way the Windows command shell (cmd) parses the line of the batch file.

How would I properly put the copyright symbol in the batch file code?  Is there a way to do that?

For instance:

"Copyright [some code here for the symbol] 2007, Yada yada"

Using the ALT-[symbol number] trick doesn't work.  When I execute the batch file, it still doesn't show up properly.  However, if I cut and paste that line onto the command prompt, it works fine.

Ideas?
Avatar of Bartender_1
Bartender_1
Flag of Canada image

How are you editing the batch file?

I find that the batch file works file if I edit it in windows notepad, save and then execute it.

I inserted the symbol into the batch file by typing "ALT +0169" in notepad.
Avatar of amendala
amendala

ASKER

Bartender -

Open up Notepad, type ALT +0169, you'll get the symbol.  Type ONLY that.  Now save the file as "mybatch.bat" and run it from the command prompt.

Do you see a copyright symbol show up?

I don't.

???
Ah.... so you want it to show up as a copyright symbol within the DOS window?

I don't think that's possible.... otherwise Microsoft would probably be using it for the "(C) Copyright 1985-2001 Microsoft Corp." that shows up whenever you open a command prompt.
then don't use notepad... use something like editpad lite (a freeware good editor) that can interpret different character encodings... in my computer, your experiment yielded that i have to convert the windows enconding to a DOS 850 encoding for my batch file to work properly... you may have to experiment a little further
Regardless of the text editor used, I still haven't found an encoding that works.  DOS 850 out of Editpad does not show a copyright symbol upon execution, it doesn't encode it properly either...  I've already been through that and TextPad.
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you notice my comment on the Alt-184 way?
Well guess it helped but only in a "B" grade kind of way....., wonder why I bother adding comments some times - above either works or it doesn't...

Steve