The "_" Windows Batch Library - now on github

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Erik Bachmann
Posts: 11
Joined: 25 Feb 2015 00:47
Location: Roskilde, Denmark

The "_" Windows Batch Library - now on github

#1 Post by Erik Bachmann » 15 Oct 2015 03:10

For years I've been looking for the ultimate DOS/Windows batch library - without much success. So I've build my own - including documentation, unit tests and examples.
The library is not a collection of snippet - like DosTips, but ready to use scripts;

The "_" Windows Batch Library (The "underscore" Windows Batch Library) is a collection of generic, ready-to-use batch scripts, that I've developed and refined over the years. Most of the script are self-made, but other sources or inspiration are mentioned in either $AUTHOR or URL tags in the scripts headers.

Experience has learned me the hard way, that one cannot rely on pre-installed scripts and functionality. Often it is not possible to install binary tools like Cygwin, Unix tools or script interpreters like Perl or PHP. This leaves me with M$ tools like Debug, Basic, Visual Basic or Powerscript. Even these tools may not be available on every system.

The scripts in this library are all pure text based source code. You should be able to install them by simply copy the library directory onto your system - and you will be ready to Rock'n'roll!

Try out:
    what.cmd - prints usage from the file given as argument (what itself is default)
    _getopt.cmd - parses command line arguments and creates environment variables
    _action.cmd + _status.cmd - used for printing process status
    FormatStr.cmd - outputs columns of strings right or left aligned

Some scripts mimik *nix functions like tail, which, wget, banner.

The scripts are available at: https://github.com/ClicketyClickDK/Underscore

Please read the README file - and if you download the library check the documentation\index.html for more details

ShadowThief
Expert
Posts: 906
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: The "_" Windows Batch Library - now on github

#2 Post by ShadowThief » 15 Oct 2015 03:35

So I notice that you're taking credit for (an outdated version of) REPL.bat...

Erik Bachmann
Posts: 11
Joined: 25 Feb 2015 00:47
Location: Roskilde, Denmark

Re: The "_" Windows Batch Library - now on github

#3 Post by Erik Bachmann » 15 Oct 2015 05:20

Not exactly. I've made a mistake at the top of the header but the header clearly states:
REPL.BAT was written by Dave Benham

You're right about this version being outdated. Sorry - I've updated to JREPL.bat right away.
Thank you for bringing this to my attention. And Dave - I apologize :oops:

Squashman
Expert
Posts: 4107
Joined: 23 Dec 2011 13:59

Re: The "_" Windows Batch Library - now on github

#4 Post by Squashman » 15 Oct 2015 06:58

Have you tested all of these scripts to see if they work on 32bit and 64bit Windows?

Erik Bachmann
Posts: 11
Joined: 25 Feb 2015 00:47
Location: Roskilde, Denmark

Re: The "_" Windows Batch Library - now on github

#5 Post by Erik Bachmann » 15 Oct 2015 07:12

Yes! Under Windows 7 32+64 bit and Windows 10. I do not have other versions available. Currently I'm not aware of any vital differences in the batch environment, that should affect these scripts. No references to %ProgramFiles%.

Squashman
Expert
Posts: 4107
Joined: 23 Dec 2011 13:59

Re: The "_" Windows Batch Library - now on github

#6 Post by Squashman » 15 Oct 2015 07:14

You also have files out there that are labeled as a batch files but are really vbscripts. This may confuse someone who is new to batch files when they can't get it work as a .bat.

Squashman
Expert
Posts: 4107
Joined: 23 Dec 2011 13:59

Re: The "_" Windows Batch Library - now on github

#7 Post by Squashman » 15 Oct 2015 07:19

Erik Bachmann wrote:Yes! Under Windows 7 32+64 bit and Windows 10.

Can a 16bit program run on a 64bit Operating System?

Erik Bachmann
Posts: 11
Joined: 25 Feb 2015 00:47
Location: Roskilde, Denmark

Re: The "_" Windows Batch Library - now on github

#8 Post by Erik Bachmann » 15 Oct 2015 07:24

Well the .BAT files ARE a wrapper to VBscript or Jscript functionality. This is indicated in the documentation:
xxx.BAT
A wrapper to VBscript or Jscript functionality.
. The scripts are wrapped using cmdize.cmd .
What do you mean by
when they can't get it work as a .bat.
.
They are indeed .bat files calling

Code: Select all

"%windir%\System32\cscript.exe"

Erik Bachmann
Posts: 11
Joined: 25 Feb 2015 00:47
Location: Roskilde, Denmark

Re: The "_" Windows Batch Library - now on github

#9 Post by Erik Bachmann » 15 Oct 2015 07:26

Can a 16bit program run on a 64bit Operating System?

Hmmm - 16 bit batch script?!? I'm not reinventing CMD.exe.

Squashman
Expert
Posts: 4107
Joined: 23 Dec 2011 13:59

Re: The "_" Windows Batch Library - now on github

#10 Post by Squashman » 15 Oct 2015 07:32

Well I copied the unzip.bat code and I can't get it to work as a batch file.

Squashman
Expert
Posts: 4107
Joined: 23 Dec 2011 13:59

Re: The "_" Windows Batch Library - now on github

#11 Post by Squashman » 15 Oct 2015 07:33

Erik Bachmann wrote:
Can a 16bit program run on a 64bit Operating System?

Hmmm - 16 bit batch script?!? I'm not reinventing CMD.exe.

You have batch files that are executing 16bit code. That will not work on 64bit Windows.

Erik Bachmann
Posts: 11
Joined: 25 Feb 2015 00:47
Location: Roskilde, Denmark

Re: The "_" Windows Batch Library - now on github

#12 Post by Erik Bachmann » 15 Oct 2015 07:46

It's a library with mutual dependencies. unzip.bat requires _debug.cmd and _GetOpt.cmd. If you need the help function as well, What.cmd is needed too.

I've added a note to the README. So please download the entire library.

ShadowThief
Expert
Posts: 906
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: The "_" Windows Batch Library - now on github

#13 Post by ShadowThief » 15 Oct 2015 07:50

cEcho.bat will not work on 64-bit operating systems because debug.exe cannot run on them.

Squashman
Expert
Posts: 4107
Joined: 23 Dec 2011 13:59

Re: The "_" Windows Batch Library - now on github

#14 Post by Squashman » 15 Oct 2015 08:01

Erik Bachmann wrote:It's a library with mutual dependencies. unzip.bat requires _debug.cmd and _GetOpt.cmd. If you need the help function as well, What.cmd is needed too.

I've added a note to the README. So please download the entire library.

I must be the only idiot here because I am not understanding how any of this works. How do you execute unzip.bat?

Squashman
Expert
Posts: 4107
Joined: 23 Dec 2011 13:59

Re: The "_" Windows Batch Library - now on github

#15 Post by Squashman » 15 Oct 2015 08:04

Erik Bachmann wrote:It's a library with mutual dependencies. unzip.bat requires _debug.cmd and _GetOpt.cmd..

Then shouldn't unzip.bat say

Code: Select all

::'::@ (#)REQUIRES
::'::@(-)  Dependencies
::'::@ (#) ]_debug.cmd  and _GetOpt.cmd

Post Reply