In arguments in batch file




















If you are working on a batch file script first time and you require to pass some value to a batch file at run time rather than hardcoding them into the file, then you will think it would not be easy. But believe me, it is easy very easy to pass parameter in batch file script. In this article, I will explain how to pass parameters in the batch file script by command line arguments.

But before solving this problem I want to introduce with batch parameter. The maximum length of any command line or variable within CMD is characters. In mathematical terms a parameter is "a numerical or other measurable factor" so typically a number. In programming terminology: A parameter represents a value that the procedure expects you to pass when you call it.

An argument represents the actual value that you pass to a procedure. In practice the phrases argument and parameter tend to be used interchangeably, CMD batch files do not perform any type checking. The FOR command creates parameter variables which are identified with a letter rather than a number e.

The Parameter Expansions described above can also be applied to these. Some characters in the command line are ignored by batch files, depending on the DOS version, whether they are " escaped " or not, and often depending on their location in the command line:.

I know of several occasions where these seemingly useless "features" proved very handy. Keep in mind, though, that these "features" may vary with the operating systems used. Windows and XP add even more options. Do note, however, that labels are case sensitive, so you may not want to use this technique for "string type" arguments.

Also keep in mind that labels cannot contain delimiters space, comma, semi-colon, etcetera , they must be unique, and that only the first 8 characters are used so the first 8 characters must be unique!



0コメント

  • 1000 / 1000