I was waiting to publish this later, but I think is better do it now. Is for present to all the users of this forum the project "Enhanced Batch" (abbreviated in this post as EB), developed with my friend Jason Hood.
Is a tool wich purpose is "Improve the functionality of your classic Windows batch files".
This tools takes control of cmd.exe adding features and new "internal" commands.
For example have you wanted this next:?
- Easily print emojis (with Windows Terminal)
- Know the line number in which for /f loop is processing
- Have a infinite loop that allow easily go out of it?
- Access to a parameter index greather than 9 whitout need of use shift?
- More flexible range generation of number than for /L ?
- No slow goto ?
With EB you can do.
At this time, after round one year of development, the code
Currently have no release, because we continue working on add new features, but you can compile the current code using TDM GCC MinGW-w64 5.1.0-2 with the command:
Code: Select all
mingw32-make
Code: Select all
https://github.com/carlos-montiers/enhancedbatch
Code: Select all
Rundll32 "%~dp0enhancedbatch_%processor_architecture%" Load
If Not Defined @enhancedbatch (
Echo Load Failed
Pause
Exit
)
Here a give you some little examples of the thing you can do with a "new batch syntax" (EB syntax):
Enable delayed expansion without create a new local environment (setlocal):
Code: Select all
set @delayedexpansion=on
emojis.cmd
Code: Select all
echo star-struck: %U+1F929%
Save a large text in other space rather than environment block, called heap:
heap-example.cmd
Code: Select all
Set $myPrivateVar=Okay
:: Looking in the environment block, it will say not defined.
Set $myPrivateVar
:: Looking if is defined in the heap
If Defined $myPrivateVar (
Echo Yep, it is defined in the heap
Echo $myPrivateVar = %$myPrivateVar%
)
Code: Select all
heap-example.cmd:10: Environment variable $myPrivateVar not defined
Yep, it is defined in the heap
$myPrivateVar = Okay
Apply filter to text variables:
Code: Select all
set "$var= oKay "
echo Default: !$no-var;'undefined'!.
echo Upper: !$var;upper!.
echo Lower: !$var;lower!.
echo Capital: !$var;capital!.
echo Length: !$var;length!.
echo Trim: !$var;trim!.
echo LTrim: !$var;ltrim!.
echo RTrim: !$var;rtrim!.
echo Trim[ oy]: !$var;trim[ oy]!.
echo LTrim[ o]: !$var;ltrim[ o]!.
echo RTrim[ y]: !$var;rtrim[ y]!.
echo Trim,Cap: !$var;trim;capital!.
Code: Select all
Default: undefined.
Upper: OKAY .
Lower: okay .
Capital: Okay .
Length: 6.
Trim: oKay.
LTrim: oKay .
RTrim: oKay.
Trim[ oy]: Ka.
LTrim[ o]: Kay .
RTrim[ y]: oKa.
Trim,Cap: Okay.
The best way of know the tool is through the demo batch files:
Here I present some slides of the demos:
demo.cmd (this is an animated gif, you need wait a little bit for see each "slide")
demo-image.cmd // display an image using gdi pixels
demo-img.cmd // display an image using characters
demo-text.cmd
Any suggestion for this tool is welcome, we continue the development with the hope of release the first version in a few months.
Feature request can be posted here:
Code: Select all
https://github.com/carlos-montiers/enhancedbatch/issues
Code: Select all
https://www.enhancedbatch.com/
EB is compatible with all cmd.exe released versions since windows 2000 !!