The "_" Windows Batch Library - now on github

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Erik Bachmann
Posts: 12
Joined: 25 Feb 2015 00:47
Location: Odense, Denmark

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

#16 Post by Erik Bachmann » 15 Oct 2015 08:07

You're right! debug.exe is not installed as default on 64 bit. Removing cEcho.exe

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

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

#17 Post by Squashman » 15 Oct 2015 10:30

You really have assumed a lot with the way your library works. I have never seen this type of syntax to make a BATCH file and VBscript into one file.

The output from the unzip help confuses me.

Code: Select all

A:\Underscore-master>unzip -h

A:\Underscore-master>SETLOCAL ENABLEDELAYEDEXPANSION

A:\Underscore-master>SET $NAME=unzip

A:\Underscore-master>SET $DESCRIPTION=Unzip an existing ZIP archive

A:\Underscore-master>SET $AUTHOR=Erik Bachmann, ClicketyClick.dk [ErikBachmann@ClicketyClick.dk]

A:\Underscore-master>SET $SOURCE=A:\Underscore-master\unzip.bat

A:\Underscore-master>SET $VERSION=2015-10-08  & SET $REVISION=16:00:00  & SET $COMMENT=GetOpt: Calling usage and exit on error / ErikBachmann

A:\Underscore-master>CALL "A:\Underscore-master\\_DEBUG"
[unzip] v.[01.050] rev.[2011-10-13T18:41:00]

NAME
      unzip -- Search file for pattern '@(#)' and print remainder of string

SYNOPSIS
      unzip [ZIP] {DIR}

OPTIONS
  -h      Help page
  ZIP     FULL path and file name of a ZIP file
  DIR     Directories where the archive should be decompressed

DESCRIPTION
  Since Windows has no build in command line tool for compressing and
  uncompressing file archive. This - originally VBS - script was build.

EXAMPLES
      ECHO:Hello world {GT} '{PCT}TEMP{PCT}\hello.txt'
      unzip '{PCT}TEMP{PCT}\myZip.zip' '{PCT}TEMP{PCT}\hello.txt'
      DIR '{PCT}TEMP{PCT}\myZip.zip'
 Or
      ECHO:Hello world{GT}'{PCT}TMP{PCT}\hello.txt'
      zip.bat '{PCT}TMP{PCT}\hello.zip' '{PCT}TMP{PCT}\hello.txt'
      DEL '{PCT}TMP{PCT}\hello.txt'
      DIR '{PCT}TMP{PCT}\hello.txt'
      unzip.bat '{PCT}TMP{PCT}\hello.zip' '{PCT}TMP{PCT}'
      DIR '{PCT}TMP{PCT}\hello.txt'

SOURCE
  A:\Underscore-master\What.cmd

(c)01.0 Erik Bachmann, ClicketyClick.dk (E_Bachmann@ClicketyClick.dk)

A:\Underscore-master>

I guess you forgot to uncomment the @ECHO OFF

The %$DESCRIPTION% variable is outputting incorrectly.

I have no idea what you are doing with all the TEXT inside the curly braces. Did you mean to substitute that with the actual value?
Are we supposed to assume you mean > and %

npocmaka_
Posts: 512
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

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

#18 Post by npocmaka_ » 15 Oct 2015 12:45

I've took a look to the zip.cmd .

I don't think setting timeout is the best idea.
As it uses the explorer.exe in case of error there will be pop-up with title "Compressed (zipped) Folders Error" (though its possible to be translated in non english version and IDK how the get the correct value in this case) so I prefer to to use shell.AppActivate("Compressed (zipped) Folders Error") on every iteration during file counting and in case there's such pop-up to exit. It's not completely bulletproof but will in far more cases and will exit right in the moment when error appear.
(The only case when the timeout is preferable is if the script is used in non-ui session e.g. with PSExec)

Also Scripting.FileSystemObject.CreateTextFile can fail if the windows system uses different than English language . I've used adodbstreams that will not depend on the locale.

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

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

#19 Post by Squashman » 15 Oct 2015 13:27

Erik Bachmann wrote: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:


You still have an old version of JREPL.bat in your library and you also BROKE the HELP function in it!

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

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

#20 Post by Squashman » 15 Oct 2015 13:54

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

Runs just fine without them.

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

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

#21 Post by ShadowThief » 15 Oct 2015 15:10

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

Runs just fine without them.


I'm getting
_DEBUG is not recognized as an internal or external command, operable program or batch file.
_Getopt is not recognized as an internal or external command, operable program or batch file.
if I don't have them.

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

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

#22 Post by Squashman » 15 Oct 2015 19:37

Comment out the two call statements or just remove those two lines. They are NOT REQUIRED for the unzip code to execute.

Post Reply