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


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


No comments:

Post a Comment

Windows 7 - How to reset Windows 7 password

This is just a post of what I had found in the Internet and it works for me (See reference for the actual post). While I knew that there a...