Monday, September 26, 2011

Windows - Command Prompt %

In Windows batch file, % can be use to get command line parameters values from input.

If you have a call a batch file with abc.exe hello world

echo %2 will return world.

There is a limitation of input parameter and the limitation is 9. That is, it can handle %0 to %9 parameters

What if you have something like this your batch file

echo hello%02world

If you call the program with abc.exe hello world, it will print

helloworldworld.

The batch program will replace %02 with the third input parameters.

You can escape % with another % parameter

So, if you batch file has


echo hello%%02world

Calling abc.exe hello world will print

hello%02world

No comments:

Post a Comment

Bootstrap Validator - Submit button remain disabled even when form is valid

If you work with Boostrap Validator (http://1000hz.github.io/bootstrap-validator/), you may experience an issue when your entire form is ...