Search found 233 matches

by Sponge Belly
01 Feb 2015 11:46
Forum: DOS Batch Forum
Topic: getTimestamp.bat for time and date processing
Replies: 45
Views: 121254

Re: getTimestamp.bat for time and date processing

@Foxi

Did you really say “look a gift horse in the mouse”? :lol:

Turn off the computer and go out into the fresh air for a walk! :D

- SB
by Sponge Belly
10 Jan 2015 06:47
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 30023

Re: eol=; tokens=*

Hello Again! Here’s some more for /f weirdness: @echo off & setlocal enableextensions disabledelayedexpansion if not exist "hash10k.txt" ( for /l %%I in (1 1 1000) do <nul set /p "=##########" >>"hash10k.txt" <nul set /p "=# " >>"hash10k.txt" ) i...
by Sponge Belly
02 Jan 2015 04:15
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 30023

Re: eol=; tokens=*

Hi Foxi, Sorry for not being clearer. The difference in the output from your first two examples is, as you inferred, what I was trying to draw attention to. When "delims=" is in effect, lines beginning with a semi-colon will be ignored. But when it’s "tokens=*", lines where the f...
by Sponge Belly
01 Jan 2015 17:11
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 30023

eol=; tokens=*

Happy 2015! Has anyone else noticed this strange behaviour? @echo off & setlocal enableextensions disabledelayedexpansion for /f "delims=:" %%N in ( 'findstr /bln __DATA__ "%~dpnx0" ') do set lino=%%N for /f "usebackq skip=%lino% eol=; tokens=*" %%A in ( "%~dpn...
by Sponge Belly
26 Dec 2014 15:23
Forum: DOS Batch Forum
Topic: reflections on jrepl and findrepl
Replies: 2
Views: 3406

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: 4618

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: 12899

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: 153607

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: 153607

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: 30863

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: 30863

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: 30863

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: 30863

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: 14574

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: 24926

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...