| 1. |
Solve : Don't quite understand this?? |
|
Answer» Code: [Select]goto label%errorlevel% The part where it says "goto label%errorlevel%" Does it mean that it would jump to the ":label" that has the correct errorlevel beside it? And then do whatever tasks that are underneath it? And also, The % on either side of the errorlevel, would that mean that it changes? Yes it does change. Most MS commands issue errorlevels that can be checked in a batch file. (generally 0 indicates the command completed successfully; anything else indicates it didn't....there are exceptions!). Also, the actual compare for errorlevel is equal to or greater than which can present some challenges when checking the codes. Myname.bat Code: [Select]@echo off cls echo Hi, my name is %1 pause The %1 is a command line parameter. The number part indicates which parm from the command line to use. myname Jack myname Suzanne Each TIME the batch file myname is run, the first parameter on the command line is substituted for the %1 variable. myname Jack will output Hi, My name is Jack myname Suzanne will output Hi, My name is Suzanne Hope this helps a little. 8-) PS. Any good DOS book from the library should be ABLE to EXPLAIN this and MUCH more.thanks! |
|