Batchfiles

This page discusses the 'batch programming' in Windows.

Good Links

Difference between !Var! and %Var% ?

Yet to find out

Tip - Remove the double quotes in the values

simply specifying "%input%" ends up generating two double-quotes when %1 has already double quoted.

to rectify that, use

"%~1"

- wherever you are referring to %1.

%~1 removes any quotes supplied by the user, if there are any.

That will result in a consistent behavior no matter whether quotes are supplied or not.

How to get the base name of the file

If %%f is the variable storing the file name,

%%~nf

will give you just the base name. [~n] is a specifier used to remove the extensions. Simply, "~" is a removal specifier.

Refer http://www.computerhope.com/forhlp.htm for the overall short cuts being used [look at the down section of the page]

How to get the file extension alone

You can refer the link given above. Use

%%~xf

provided, %%f is the variable holding the complete file name.

How to set and increment a variable in a dos program?

You can use "set" command with a "/a" switch.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.