Enhanced Batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Enhanced Batch

#1 Post by carlos » 22 Dec 2019 21:38

Hello.
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
The code is available in:

Code: Select all

https://github.com/carlos-montiers/enhancedbatch
One you have the dlls you need run this command:

Code: Select all

Rundll32 "%~dp0enhancedbatch_%processor_architecture%" Load
If Not Defined @enhancedbatch (
Echo Load Failed
Pause
Exit
)
And that is all. Now you have access to new features of batch and EB filters and EB commands called "extensions".

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
Easily encode unicode characters and display it using Windows Terminal:
emojis.cmd

Code: Select all

echo star-struck: %U+1F929%
Image

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%
)
prints:

Code: Select all

heap-example.cmd:10: Environment variable $myPrivateVar not defined
Yep, it is defined in the heap
$myPrivateVar = Okay
Also you can notice how EB, by default in case of error says the batch filename and the line whre the error was produced, in this case the line 10.
Image

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!.
prints:

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")
Image

demo-image.cmd // display an image using gdi pixels
Image

demo-img.cmd // display an image using characters
Image

demo-text.cmd
Image

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
The documentation of the tools is in

Code: Select all

https://www.enhancedbatch.com/
(currently not fully updated)

EB is compatible with all cmd.exe released versions since windows 2000 !!

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Enhanced Batch

#2 Post by dbenham » 28 Dec 2019 21:41

Interesting project. I've had a brief moment to try this out - I see some very nice features 8)

I'm looking forward to the full release with documentation :!:

DQ2000
Posts: 38
Joined: 07 Aug 2019 17:26

Re: Enhanced Batch

#3 Post by DQ2000 » 29 Dec 2019 08:29

very good!! That's what I was talking about. You were faster to publish it so I will cancel my project

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Enhanced Batch

#4 Post by carlos » 29 Dec 2019 17:44

dbenham wrote:
28 Dec 2019 21:41
Interesting project. I've had a brief moment to try this out - I see some very nice features 8)

I'm looking forward to the full release with documentation :!:
thanks Dave. Minutes ago I updated the documentation in the site related to:

- For /f features: option "line"
- For shortcuts to For infinite and For range
- Parameter helpers with syntax for get parameters.
- Set features: assignment and append.
- Subroutine features: improve finding labels and operator ~.
- Filters section: workaround.
- Filters: hexify, unhexify.

With that is almost update, is only missed the documentation that you can found in the caller extensions.

About full release, is needed wait some time.
DQ2000 wrote:
29 Dec 2019 08:29
very good!! That's what I was talking about. You were faster to publish it so I will cancel my project
Thanks Daniel, about your project, it is nice also.
In my case I will keep with EB, because with that we are trying to solve many things related to batch, for example, it provides faster find of labels, no more slow goto, for infinite, timers. If you are interested on write small 2d batch games, I think with EB will be possible, altough is not the main purpose of the tool.

DQ2000
Posts: 38
Joined: 07 Aug 2019 17:26

Re: Enhanced Batch

#5 Post by DQ2000 » 30 Jan 2020 23:06

Hi Carlos. :D could you implement my sprite viewer?

Post Reply