Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 11-12 of 12 total

Lowercasing a string in BAT files

Using this silliness, here's an example of BAT file that will
lower-case a string given as an argument.

echo>%1
dir /b/l %1>lower.tmp
set /p result=<lower.tmp
echo %result%


Saving this as lower.bat, I run

lower "HELLO WORLD"


and get

hello world

as a result

Using Unix shell's backquote functionality in DOS/Windows batch files

In BAT files, an equivalent of a Unix shell's
set foo `bar`


can be accomplished as

bar>bar.tmp
set /p foo=<bar.tmp


If you're spoiled by Unix's notion of
true pipes, note that the following:

bar | set /p foo=


does not work.
« Newer Snippets
Older Snippets »
Showing 11-12 of 12 total