Computing.Net > Forums > Disk Operating System > why Bad command or file name??

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

why Bad command or file name??

Reply to Message Icon

Name: neversetsun
Date: December 12, 2004 at 06:57:52 Pacific
OS: DOS6.22
CPU/Ram: celeron 375MHz
Comment:

here is my autoexec.bat:
====beginning of autoexec.bat===
@ECHO OFF
PROMPT $p$g
PATH C:\NET;C:\DOS;C:\turbop7\bin;C:\BORLANDC\BIN
SET TEMP=C:\DOS
doskey
echo enter autoexec.bat

; go to the section that matches the current value of the CONFIG system variable
goto %CONFIG%


:normal_conf
echo enter normal configuration
goto end


:debug_conf
echo enter debug configuration
goto end


:net_conf
echo enter net configuration
C:\NET\net initialize
C:\NET\nwlink
C:\NET\net start
rem c:\net\net start server
goto end


:end
====end of autoexec.bat===

Why does "Bad command or file name" show every time I restart the computer?
What's more this message shows between "Enter autoexec.bat" and "enter XXX configuration" where XXX maybe normal, debug or net.
I'm really confused about this.Anyone here can give a hint?



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: December 12, 2004 at 09:57:17 Pacific
Reply:

That may be caused by your comment line beginning with ";". Try the native batch comment identifier Rem and report if the annoiance stops.



0

Response Number 2
Name: jboy
Date: December 12, 2004 at 11:51:03 Pacific
Reply:

That's likely it - semicolon can be used in config.sys, but not batch files.

Double colon is an alternative ::


Never argue with an idiot. They will only bring you down to their level and beat you with experience


0

Response Number 3
Name: neotms88
Date: December 12, 2004 at 17:36:11 Pacific
Reply:

doskey might also be the prob. as it might have been deleted. I use ;s in batch files but I haven't had a bad command or file name from them.

Customer: Do you have any mouse pads?

Salseman, pointing: Over there.

Customer: Great!, will they be comadible with my computer.


0

Response Number 4
Name: jboy
Date: December 12, 2004 at 18:08:51 Pacific
Reply:

The semicolon doesn't do anything at all, so the line go to the section that matches the current value of the CONFIG system variable (or a portion of it) attempts to execute - hence the 'bad command' message.

REM

Not even going to ask why you use semicolons in your batch files (in case you tell me)

Once again your insights & obvious experience have proven invaluable, and your contributions here... well, they defy description.

Never argue with an idiot. They will only bring you down to their level and beat you with experience


0

Response Number 5
Name: neversetsun
Date: December 12, 2004 at 18:27:00 Pacific
Reply:

Thank you all very much.
I write autoexec.bat according to an example in DOS help. You may find it in the section
"MS-DOS Help: Multiple Configurations -- Examples".


0

Related Posts

See More



Response Number 6
Name: melee5
Date: December 12, 2004 at 19:01:55 Pacific
Reply:

Does the %CONFIG% variable method even apply to real DOS (6.22)? 98's boot disk uses it but gets it from config.sys [menu] and selection from the menu then setting the %CONFIG% variable. I find it a little hard to believe that 6.22 supports it at all (I don't have 6.22 or I would know). And according to the batch file posted, Shi is trying to use it as given from config.sys.

May we also see config.sys? Also exact DOS version please.


0

Response Number 7
Name: jboy
Date: December 12, 2004 at 21:14:57 Pacific
Reply:

Yes - the multiple configuration feature was introduced with MS-DOS6 - believe it.

Exact version already given (??)

What point in seeing config.sys?? - for a fact, 'bad command or filename' cannot be generated from such.

Anything else?

I'd say the problem was resolved with IVO's post - it's the absence of the REM statement, so the 'comment' is processed as a command.

No real confirmation from the OP - the cited source does indeed use semicolons in place of REM - it is in error though. Try it.

Never argue with an idiot. They will only bring you down to their level and beat you with experience


0

Response Number 8
Name: Mechanix2Go
Date: December 12, 2004 at 21:33:21 Pacific
Reply:

Hi gang,

Yes, the semicolon in DOS is no good as a substitute for rem.

But a double colon is.

DOS "sees" it as an unaddressed label.

Yes, I think IVO nailed it.

When I have an error situation like this, I put a pause below the suspect line.


M2

Mechanix2@Golden-Triangle.com


0

Response Number 9
Name: jboy
Date: December 13, 2004 at 10:51:53 Pacific
Reply:

Well, it just won't work in BATs (for config.sys it's ok)

If in doubt, F8 at bootup for line-by-line confirmation.

For other batchfiles use 'command /y /c mybat.bat' to debug


Never argue with an idiot. They will only bring you down to their level and beat you with experience


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: why Bad command or file name??

DOSHELL Bad Command Or File Name www.computing.net/answers/dos/doshell-bad-command-or-file-name/15934.html

MSDOS responds BAD COMMAND OR FILE www.computing.net/answers/dos/msdos-responds-bad-command-or-file/15910.html

I use msd.exe and get bad command www.computing.net/answers/dos/i-use-msdexe-and-get-bad-command/5932.html