Search found 199 matches

by Sponge Belly
26 Dec 2014 15:23
Forum: DOS Batch Forum
Topic: reflections on jrepl and findrepl
Replies: 2
Views: 1521

reflections on jrepl and findrepl

Dear Dave and Aacini, First of all, let me say that jrepl and findrepl are excellent programs. Some may grumble that they are JavaScript wrapped in Batch, but I don’t think that’s a valid criticism because it would be simply impossible to write a program in “pure Batch” (whatever that is) that would...
by Sponge Belly
26 Dec 2014 14:23
Forum: DOS Batch Forum
Topic: All I Want for Christmas…
Replies: 3
Views: 1964

All I Want for Christmas…

Dear DosTippers, I have a complete set of 3.5inch floppies that came shrink-wrapped with an early 1990s Digital Equipment Corporation (DEC) PC. DEC later sold off their PC division to Compaq who were in turn swallowed up by HP. Anyways, the point is, I have the disks for MS-DOS 6.2 and Windows 3.1… ...
by Sponge Belly
25 Dec 2014 06:58
Forum: DOS Batch Forum
Topic: bowling, anyone?
Replies: 7
Views: 4360

Re: bowling, anyone?

Happy Christmas, All! :)

I found a treasure trove of download links to hard-to-find old NStorm games including Frogapult and the first three games in the Elf Bowling series.

Enjoy!

- SB
by Sponge Belly
27 Oct 2014 04:15
Forum: DOS Batch Forum
Topic: Create nul and all ascii characters with only batch
Replies: 110
Views: 59106

Re: Create nul and all ascii characters with only batch

Hi Squashman, Dave Benham first proposed using forfiles to generate nearly any character, including tab 2 years ago. As noted at the time, the trouble with forfiles is that it isn’t present on all versions of Windows. Makecab, otoh, is. So my little snippet should work out-of-the-box on XP and above...
by Sponge Belly
26 Oct 2014 12:53
Forum: DOS Batch Forum
Topic: Create nul and all ascii characters with only batch
Replies: 110
Views: 59106

Re: Create nul and all ascii characters with only batch

Hello All! I modified the code developed in this thread to store a tab in a variable: @echo off & setlocal enableextensions disabledelayedexpansion type nul >tab.tmp makecab /d compress=off /d reserveperdatablocksize=0 ^ /d reserveperfoldersize=9 tab.tmp tab.tmp >nul for /f "skip=28 delims=...
by Sponge Belly
25 Oct 2014 06:56
Forum: DOS Batch Forum
Topic: robust line counter
Replies: 22
Views: 11409

Re: robust line counter

Penpen wrote: I assume the safest way is, to to use fc.exe and count the hex newline characters and add 1 to get the linecount.
That’s what made me think you were incorrectly adding 1 to the line count when a file ended with a LF. Sorry I misunderstood.
by Sponge Belly
24 Oct 2014 12:41
Forum: DOS Batch Forum
Topic: robust line counter
Replies: 22
Views: 11409

Re: robust line counter

Argh! Hoisted by my own petard . I neglected the edge-case of a file whose last line is a single non-LF character. See this post for revised code. @Penpen Using fc /b to count the LFs in a file is an interesting approach, but you fell into the same trap I did. Your code counts the number of LFs and ...
by Sponge Belly
21 Oct 2014 10:27
Forum: DOS Batch Forum
Topic: robust line counter
Replies: 22
Views: 11409

Re: robust line counter

Thanks to everyone who replied… @Siberia-Man More has problems as pointed out by Squashman above and in this post . Type would be a better alternative: type filename.txt | find /c /v "" @FoxiDrive Using redirected input from a file with find is unreliable… as you yourself discussed in this...
by Sponge Belly
20 Oct 2014 07:44
Forum: DOS Batch Forum
Topic: robust line counter
Replies: 22
Views: 11409

Re: robust line counter

Jump to this post for the latest version of the subroutine.
by Sponge Belly
19 Oct 2014 10:18
Forum: DOS Batch Forum
Topic: Another way to create a line feed variable
Replies: 8
Views: 5359

Re: Another way to create a line feed variable

Hello All! In a post on another topic , Dave Benham observed: SET /P will terminate the input upon reading a NULL byte. What really blows me away is that SET /P can read both newline (0x0A) and carriage return (0x0D) into a variable if they are followed by 0x00. With the caveat that there has to be ...
by Sponge Belly
15 Sep 2014 14:30
Forum: DOS Batch Forum
Topic: create dummy files of exact size
Replies: 15
Views: 8301

Re: create dummy files of exact size

Hi Again! Sorry for the delay, but I’m easily… oh look, a shiny object! Anyways, I’ve rewritten the code to create a dummy file that has the same size as the original. The program accepts two arguments: the original filename (required); and the ASCII code of the fill character (0 by default). If all...
by Sponge Belly
26 Aug 2014 14:08
Forum: DOS Batch Forum
Topic: A different method to trim spaces from a string
Replies: 16
Views: 9201

Re: A different method to trim spaces from a string

Hello All! I reread this topic and felt there must be a way to coax %* into right-trimming an arbitrary string. I played around with the code of some of the contributors and discovered that CALL doesn’t enforce a closing quote for the parameter passed to a subroutine. The following kludgy code illus...
by Sponge Belly
22 May 2014 17:02
Forum: DOS Batch Forum
Topic: Get only first row for each file
Replies: 10
Views: 7826

Re: Get only first row for each file

Hello All! Sorry to revive an old topic, but avery_larry seems to be saying that the following: for /f "usebackq delims=" %%f in ("file.txt") do ( echo(%%f goto break ) :break (rest of program) will display the first non-empty line of file.txt without the overhead of expanding th...
by Sponge Belly
14 May 2014 14:27
Forum: DOS Batch Forum
Topic: create dummy files of exact size
Replies: 15
Views: 8301

Re: create dummy files of exact size

Wow! Thanks to everyone for their great feedback. @Einstein1969: Interesting approach. I mean to put your code under the microscope when I have more time. A quick test on a file 1049 bytes long created dd.tmp which was also 1049 bytes. Unfortunately, another file called d.tmp was left over after exe...
by Sponge Belly
14 May 2014 05:49
Forum: DOS Batch Forum
Topic: ECHO. FAILS to give text or blank line - Instead use ECHO/
Replies: 38
Views: 101529

Re: ECHO. FAILS to give text or blank line - Instead use ECH

Hi Liviu!

Thanks for the explanation.

But why doesn’t…

Code: Select all

(call;>>file.txt)


clobber the SUB at the end of file.txt?

- SB