1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

DOS Commands more help please

Discussion in 'DOS/Other' started by Duckman69, Jul 7, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. Duckman69

    Duckman69 Thread Starter

    Joined:
    Jun 26, 2007
    Messages:
    818
    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 :/
     
  2. ViprXX

    ViprXX

    Joined:
    May 12, 2007
    Messages:
    392
    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
     
  3. Duckman69

    Duckman69 Thread Starter

    Joined:
    Jun 26, 2007
    Messages:
    818
    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...
     
  4. ViprXX

    ViprXX

    Joined:
    May 12, 2007
    Messages:
    392
    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.
     
  5. Duckman69

    Duckman69 Thread Starter

    Joined:
    Jun 26, 2007
    Messages:
    818
    alright thanks again :D 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...
     
  6. ChuckE

    ChuckE

    Joined:
    Aug 30, 2004
    Messages:
    2,311
    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 REMark (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 REMs 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.
     
  7. ChuckE

    ChuckE

    Joined:
    Aug 30, 2004
    Messages:
    2,311
    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.
     
  8. Duckman69

    Duckman69 Thread Starter

    Joined:
    Jun 26, 2007
    Messages:
    818
    thanks for the input checke ill have to look at those start commands tomorrow
     
  9. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    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.
     
  10. ChuckE

    ChuckE

    Joined:
    Aug 30, 2004
    Messages:
    2,311
    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?
     
  11. Duckman69

    Duckman69 Thread Starter

    Joined:
    Jun 26, 2007
    Messages:
    818
    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
     
  12. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    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.
     
  13. Duckman69

    Duckman69 Thread Starter

    Joined:
    Jun 26, 2007
    Messages:
    818
    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?
     
  14. ChuckE

    ChuckE

    Joined:
    Aug 30, 2004
    Messages:
    2,311
    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.
     
  15. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/592732

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice