

InterviewSolution
Saved Bookmarks
1. |
Solve : MS Dos bat file failure on first character? |
Answer» <html><body><p>Hi,<br/>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:<br/><br/>'?p' is not recognized as an internal or external command, operable <a href="https://interviewquestions.tuteehub.com/tag/program-246414" style="font-weight:bold;" target="_blank" title="Click to know more about PROGRAM">PROGRAM</a> or batch file.<br/><br/>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<br/>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<br/>character in my .bat file and failing immediately on that.<br/>Any help would be appreciated. this is on XP service pack 3. Thanks...<br/>what are you using to make the batch files?<br/><br/>try to open one in notepad and save it as a text file and then rename it to .bat<br/><br/>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.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. Can you post an example bat file? It would be interesting to see the problem.<br/><br/><br/>Thanks<br/>This should not be a problem with notepad.<br/>I can not duplicate the problem from you information.<br/>you can start notepad from the command line<br/> Code: <a>[Select]</a>Microsoft Windows XP [Version 5.1.2600]<br/>(C) Copyright 1985-2001 Microsoft Corp.<br/><br/>d:\batch>start notepad test.bat<br/> Quote from: 32handicap on February 03, 2010, 12:12:13 PM</p><blockquote>I have a problem in that every .bat file i run fails because the there is an invisible character inserted at the beginning</blockquote> <br/>This is the clue:<br/><br/> Quote<blockquote>'?p' is not recognized as an internal or external command, operable program or batch file.</blockquote> <br/>Diagnosis: file saved as <a href="https://interviewquestions.tuteehub.com/tag/unicode-16137" style="font-weight:bold;" target="_blank" title="Click to know more about UNICODE">UNICODE</a>. (Tested, reproduced)<br/>Solution: save file as ANSI. (Ditto)<br/>Salmon <a href="https://interviewquestions.tuteehub.com/tag/trout-661901" style="font-weight:bold;" target="_blank" title="Click to know more about TROUT">TROUT</a>, you rock! 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 <a href="https://interviewquestions.tuteehub.com/tag/tv-344064" style="font-weight:bold;" target="_blank" title="Click to know more about TV">TV</a> show), would say: " here's what happened". I <a href="https://interviewquestions.tuteehub.com/tag/must-1702064" style="font-weight:bold;" target="_blank" title="Click to know more about MUST">MUST</a> 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. <br/> <br/>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.<br/><br/>This one was driving me crazy and I was coming to the point that i had to have it figured out. <br/><br/>THANKS TO ALL THAT WEIGHED IN AND ESPECIALLY THE BIG FISH IN THE BIG POND</body></html> | |