Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I am new to batch files. I recently read a batch file.
...
IF NOT EXIST %1 (CALL :CMDLine %1)
IF NOT EXIST %2 (CALL :CMDLine %2)
IF NOT EXIST %2\logs\%3 (CALL :CMDLine %3)
IF NOT EXIST %4 (CALL :CMDLine %4)
...
Parameters 1, 2, 3, 4 are paths and names of some applications.
The batch file was set up to run once every week automatically. I don't underestand how this file can find those parameters? Should I set up something so that the file know where those paraemters are?Also, what does :CMDLINE mean?
Thanks!
qiqi

The %1, %2 and so on parameters are "external variables" to be coded on the batch's command tail, i.e. if the script is named MyBatch it would be launched as
MyBatch Param1 Param2 Param3 Param4
where ParamN as you posted are file/folder names.
:CDMLINE is a "label" for an internal subroutine to be called with the expressed tail parameter, i.e. if Param1 is C:\Test\MyFile (on the batch's command tail), then at run time
Call :CMDLINE %1
becomes
Call :CMDLINE C:\Test\MyFile
How this parameter is processed inside the routine and the difference between internal and external subroutine is far beyond thi short note.
Walking through the batch you'll find a label :CMDLINE at thr beginning of a line: that is the entry point of the internal subroutine that must end with GoTo :EOF.
This is a NT batch script mor powerfull than a native DOS one for Win 9X/ME; you have a long way to walk in front of you.

![]() |
![]() |
![]() |

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