Home / Microsoft / Microsoft DOS / MS Dos bat file failure on first character
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: MS Dos bat file failure on first character  (Read 1168 times)
32handicap
Topic Starter
Starter



Posts: 3


« on: February 03, 2010, 12:12:13 PM »

Hi,
I have a problem in that every .bat file i run fails because the there is an invisible character inserted at the beginning.  For example, if i make a simple bat file consisting of just one command, "pause", i get the following error message:

'?p' is not recognized as an internal or external command, operable program or batch file.

the ? is actually a solid rectangle, (ie funny invisible character).  Because of this, i cannot run any .bat files.  the 'p' is from pause.  If i start a bat file
with a command starting with a different letter, i will get that letter.  So this pretty much tells me it is just inserting a funny character in front of the first
character in my .bat file and failing immediately on that.
Any help would be appreciated.  this is on XP service pack 3.  Thanks...
IP logged
Spoiler
Mentor



Thanked: 46
Posts: 1,689

Experience: Beginner
OS: Windows XP

« Reply #1 on: February 03, 2010, 12:14:35 PM »

what are you using to make the batch files?

try to open one in notepad and save it as a text file and then rename it to .bat

IP logged

Whenever I watch TV and I see those poor starving kids all over the world, I can't help but cry. I mean I would love to be skinny like that, but not with all those flies and death and stuff." - Mariah Carey, Pop Singer
32handicap
Topic Starter
Starter



Posts: 3


« Reply #2 on: February 03, 2010, 12:16:55 PM »

yes, i do make them in notepad. very vanilla.  Which is why i use the "pause" example.  of course just having pause in a .bat file is fairly useless.  But since i saw this happening, as part of my diagnosis, i just got down to the simple "pause" .bat file and it failed.  and i do make them wth notepad and rename them to .bat.
IP logged
Helpmeh
Egghead



Thanked: 117
Posts: 3,608

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #3 on: February 04, 2010, 04:54:52 AM »

Try downloading Notepad++. It will probably circumvent your problem. It also has a lot of useful features, so I suggest you keep it even if it doesn't fix your problem.
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Spoiler
Mentor



Thanked: 46
Posts: 1,689

Experience: Beginner
OS: Windows XP

« Reply #4 on: February 04, 2010, 06:46:02 AM »

Can you post an example bat file? It would be interesting to see the problem.


Thanks
IP logged

Whenever I watch TV and I see those poor starving kids all over the world, I can't help but cry. I mean I would love to be skinny like that, but not with all those flies and death and stuff." - Mariah Carey, Pop Singer
Geek-9pm
Sage



Thanked: 373
Posts: 8,931

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #5 on: February 04, 2010, 12:54:33 PM »

This should not be a problem with notepad.
I can not duplicate the problem from you information.
you can start notepad from the command line
Code: [Select]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

d:\batch>start notepad test.bat
IP logged

Salmon Trout
Sage



Thanked: 546
Posts: 7,954

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #6 on: February 04, 2010, 01:19:31 PM »

I have a problem in that every .bat file i run fails because the there is an invisible character inserted at the beginning

This is the clue:

Quote
'?p' is not recognized as an internal or external command, operable program or batch file.

Diagnosis: file saved as Unicode. (Tested, reproduced)
Solution: save file as ANSI. (Ditto)
« Last Edit: February 04, 2010, 01:54:38 PM by Salmon Trout » IP logged


Proud to be European
Geek-9pm
Sage



Thanked: 373
Posts: 8,931

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #7 on: February 04, 2010, 02:01:48 PM »

Salmon Trout, you rock!  :)
IP logged

32handicap
Topic Starter
Starter



Posts: 3


« Reply #8 on: February 05, 2010, 11:09:40 AM »

Salmon Trout, you definately rock and are da' man, da' fishes, the da' whatever you want to be.  And i was the butler in this who-doneit all along.  As Monk, (if you ever saw the tv show),  would say: " here's what happened".  I must have, at one time, started to make a batch file from a ".txt" file i had saved once from the C# visual studio IDE or somthing like that.  Once i had the problem, I kept editing it with notepad even to the point of blanking out the file and then typing in "pause" for the test.  The fly was already baked in the ointment.  No amount of editing with notepad will fix it. 
 
I just made a text file the C# express IDE and confirmed that it does "mess" up the file.  I "blanked" out the file and I did a file compare with a blank file i had just made from notepat and the compare utility showed the "invisible" character as a diff.

This one was driving me crazy and I was coming to the point that i had to have it figured out. 

THANKS TO ALL THAT WEIGHED IN AND ESPECIALLY THE BIG FISH IN THE BIG POND
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / MS Dos bat file failure on first character « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.106 seconds with 20 queries.