# DOS Commands more help please



## Duckman69 (Jun 26, 2007)

Im just gettin back to all this so im sorry im posting again for some help in this area but i should be good after this...

i tried * & ' for putting comments in a .txt file to be a .bat file... & when it runs i get its not a command -- i just want to know a command so i can comment in the text version of the log...

i also would like to know how to get the call function to work if any1 knows... i tried to call a file but with no success i belive i did call c:\location & i tried [c:][location] some site mentioned to try that way neither worked for me :/


----------



## ViprXX (May 12, 2007)

Not sure about the Call function but I believe it is used to call another batch file up and not just any old file but not sure of the specifics but you can use the REM command to add comments. ie. REM (insert comment)
Hope this helps


----------



## Duckman69 (Jun 26, 2007)

Thank you it sure does help, any chance you may know of a the new msgbox command or any other way to get a yes no box up? msgbox use to work was just looking it up its even listed on a site i was looking at but it doesnt seem to work properlly for me

msg = ok box

hi=msgbox ("hi", 20, "the hi box")
or msgbox = 
both ways i get msgbox is not a recognized command 

Thanks for the REM i forgot about that... this is all so ancient to me its fun playing with this stuff though...


----------



## ViprXX (May 12, 2007)

glad I could help some. Sorry, don't know about the message box command tho. I haven't messed with dos in ages. I'm sure someone else here on the board can help you with the msg command.

Link below has all dos commands and should help you out.

http://www.computerhope.com/msdos.htm

good luck.


----------



## Duckman69 (Jun 26, 2007)

alright thanks again  ill have a look there ive been checkin a few sites somereason i just run into trouble with some either not supported in my current os or outdated commands i dont know... anyway thanks again...


----------



## ChuckE (Aug 30, 2004)

The "&" DOS command is not for putting comments in a file, it is a command separator. It is almost like you have a new command line starting right after the "&"

For example, if you had a line like:
*echo first line&echo second line*
it is almost like you had:
*echo first line
echo second line*

If you really want to use the "&" to have an entry for comments, then you want to make sure that a *REM*ark (or something like it) follow it, to tell DOS what follows is a comment. Otherwise whatever you had typed following the "&" looks like a command to DOS. That will probably give you a "command not recognized" error.

But I have a better idea, and as a person who has made lots of batch files, I like to use some really standout thing to denote a comment.
I use two colons ("::") at the beginning of a line. Such as:
*:: This is a test batch file
echo first line
:: That should put a line of text on the screen, and
:: the next line will now say -> "second line"
echo second line
:: That is the end of the example*

The reason that I like to use two colons is that it is more efficient. Using a *REM* is a DOS command that takes time for DOS to evaluate. If you had a hundred lines of *REM*s then DOS will take the time to still evaluate the entire line. That is one of the reasons that you can not use arrow characters > and < on the *REM*.
Whereas, you can see that in my example that arrows can be used.

A line beginning with a colon is a label, and DOS will not spend any time to evaluate a label unless there was some reference to it. A second colon invalidates the label, and thus you are guaranteed that DOS will never use whatever you have as text on the line.
So, using two colons at the start of a line, even a hundred lines using two colons, and DOS spends almost no time at all in parsing the line. It sees the "label" signifier and then immediately goes to the next line. Much quicker.


----------



## ChuckE (Aug 30, 2004)

As for using the *CALL*, as already had been mentioned, *CALL* is for calling one batch file (with parameters) from another batch file.

If you want to start another program, try using the *START* command.
A new cmd window will open for that *START* command.
Even there you can use some switches like *START /MAX* or *START /MIN* to define the opening size of that 2nd cmd window.

There are other useful switches for the command *START* too. 
Check them out by typing, in a cmd window, *HELP START*

Good luck.


----------



## Duckman69 (Jun 26, 2007)

thanks for the input checke ill have to look at those start commands tomorrow


----------



## Squashman (Apr 4, 2003)

Duckman69 said:


> both ways i get msgbox is not a recognized command
> ...


Probably because the command is not in your path. Drop the msgbox command in a direcotry that is in your path or reference the command with the full path to the executable.


----------



## ChuckE (Aug 30, 2004)

Duckman69 said:


> any chance you may know of a the new msgbox command ...


What new msgbox command? I have never heard of a DOS 'msgbox' command. At least not one that is built into the MS installed DOS.

There are plenty of 3rd party suppliers of special function executables for DOS. I'm sure I can find one for you, if you want. Or you could just tell us where you have used this command before. Perhaps it came with some installed program. I read, at one place, that HP installs some 'msgbox' command. Is that possibly the one you were talking about?


----------



## Duckman69 (Jun 26, 2007)

after some research and thinking i think i remembered the command from vb scripts when i use to use vb 3 back in the day, but thanks for the help


----------



## Squashman (Apr 4, 2003)

MsgBox is a third party utility you can use in Batch Files. I use it for a couple of mine. There are a couple of different ones out there. Some are free some are not.


----------



## Duckman69 (Jun 26, 2007)

if you were to download the patch to make it work and compile a program with the command in it and run it on another computer tho it would recive an error correct?


----------



## ChuckE (Aug 30, 2004)

If you were to compile a program with all references and calls held totally within the compilation, then it should not give you an error for referring to something that is not present - because that sub-routine is already there.

You might get an error for some other reason, though. If you are the programmer then you are the one to design for those possible contingencies.


----------

