This page discusses the 'batch programming' in Windows.
Good Links
- http://ss64.com/nt/ [Good Site]
- http://www.dostips.com/
- http://www.ahuka.com/dos/index.html
- http://www.computerhope.com/msdos.htm [Good Site]
- A Forum: http://www.computing.net/
- Advanced Batch Programming - From the Basics to Recursivity -> http://osix.net/modules/article/?id=755
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.