Search found 222 matches

by Sponge Belly
19 Nov 2018 09:14
Forum: DOS Batch Forum
Topic: Special Chracters in file
Replies: 2
Views: 3457

Re: Special Chracters in file

Hi SIMMS7400, :)

Please read the topic about Dave Benham’s excellent parseCSV Batch/JS hybrid utility, which should do what you want—and then some! ;)

- SB

PS: Please fix typo in subject line.
by Sponge Belly
23 Sep 2018 05:33
Forum: DOS Batch Forum
Topic: Why ~dpf ?
Replies: 9
Views: 13163

Re: Why ~dpf ?

@carlos @sst

Thanks for the great explanations and links! :)

I’ll use a function to store the value of "%~f0" in a variable from now on. Just one more nonsensical Batch thing to remember! :lol:

- SB
by Sponge Belly
19 Sep 2018 15:46
Forum: DOS Batch Forum
Topic: Why ~dpf ?
Replies: 9
Views: 13163

Re: Why ~dpf ?

Hi sst, :) I saw an explanation for using "%~dpf0" somewhere a long time ago. I think it was by jeb, but I could never find it again. :( And then I noticed a subroutine you used in this SO Answer : :getBatFullPath set "%~1=%~f0" & exit /b You said it was a “workaround for CMD %~0 bug.” Please give a...
by Sponge Belly
28 Feb 2018 13:46
Forum: DOS Batch Forum
Topic: robust line counter
Replies: 22
Views: 22921

Re: robust line counter

Below is my third (and hopefully final) version of my line-counting subroutine: @echo off & setLocal enableExtensions disableDelayedExpansion call :countLines noOfLines "%~1" || ( >&2 echo(file "%~nx1" is empty & goto end ) %= cond exec =% echo(file "%~nx1" has %noOfLines% line(s) :end - exit progra...
by Sponge Belly
19 Feb 2018 09:06
Forum: DOS Batch Forum
Topic: reverse string without goto
Replies: 10
Views: 14506

Re: reverse string without goto

Belated thanks to Penpen for his informative response to my previous effort. Please find below my revised code for reversing a string: @echo off & setLocal enableExtensions disableDelayedExpansion (call;) %= sets errorLevel to 0 =% (set lf=^ %= BLANK LINE REQUIRED =% ) set "cr=" & if not defined cr ...
by Sponge Belly
11 Feb 2018 14:49
Forum: DOS Batch Forum
Topic: Discussion about jeb's batch parsing rules on StackOverflow
Replies: 42
Views: 48388

Re: Discussion about jeb's batch parsing rules on StackOverflow

Hi Dave, Thanks for the detailed explanation. I noticed consecutive LFs were being converted into a single space when I was trying to capture an input parameter inside the in (…) clause of a FOR /F loop using the REM tecchnique. I tried all kinds of crazy things, including piping the output from the...
by Sponge Belly
10 Feb 2018 14:08
Forum: DOS Batch Forum
Topic: Discussion about jeb's batch parsing rules on StackOverflow
Replies: 42
Views: 48388

Re: Discussion about jeb's batch parsing rules on StackOverflow

Hi Dave and Jeb! :) How about this for strange behaviour? multiLine.cmd: @echo off & setLocal enableExtensions disableDelayedExpansion prompt @ for /f "delims=" %%A in (' for /f %%B in ("1"^) do rem # %1 # ') do @echo(%%A echo on @( @for /f "delims=" %%A in ("1") do rem: # %1 # ) | @findStr "^" @ech...
by Sponge Belly
01 Jan 2018 04:43
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 32
Views: 44155

Re: Split string to characters

Hello Penpen and Happy 2018! :)

Your first solution is very reductionist… I love it! 8)

My only criticism is that it prints 2 newlines for a single LF.

As for your second solution, I’m still trying to figure it out. :lol:

Thanks for your feedback.

- SB
by Sponge Belly
28 Dec 2017 10:53
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 32
Views: 44155

Re: Split string to characters

Hello All, Sorry I’m late to the party, but here’s my proffered solution to this hoary old chestnut of a problem: @echo off & setLocal enableExtensions disableDelayedExpansion (call;) %= sets errorLevel to 0 =% set "testStr=uncopyrightable" call :splitStr testStr if errorLevel 1 ( >&2 echo(string is...
by Sponge Belly
06 Dec 2017 15:21
Forum: DOS Batch Forum
Topic: revamped forum
Replies: 38
Views: 36055

Re: revamped forum

Hi All, I second Catalinnc’s sentiments! I’m not happy with this forum’s new style. I went through the list of styles provided by Steffen. They may look different on the surface, but they’re all the same underneath. By which I mean, they all use lists instead of tables. View the HTML source to see w...
by Sponge Belly
28 Nov 2017 17:27
Forum: DOS Batch Forum
Topic: revamped forum
Replies: 38
Views: 36055

Re: revamped forum

Hi Steffen, Thanks for your reply. I tried your suggestions, but nothing worked. The new forum style overuses (imho) lists. The old style I was familiar with used tables, which are far easier for me to navigate. Please ask Peter the admin to add some styles and to allow mere mortals like myself to s...
by Sponge Belly
28 Nov 2017 06:37
Forum: DOS Batch Forum
Topic: revamped forum
Replies: 38
Views: 36055

Re: revamped forum

Hello Again!

Is it just me or has the forum reverted to some default style? How do I reset it? I looked through my settings and I couldn’t find it. :(

TIA!

- SB
by Sponge Belly
13 Nov 2017 09:27
Forum: DOS Batch Forum
Topic: strimmer: a string trimmer
Replies: 5
Views: 6609

Re: strimmer: a string trimmer

Hello Again! :) Wow, I can’t believe this topic is over 4 years old! :shock: What an enthusiastic little puppy I was in those days… :roll: Anyways, I’ve revised the code for my string strimmer. It is now completely expansion-insensitive and exploits the option to omit the closing quote in the last p...
by Sponge Belly
05 Sep 2017 09:46
Forum: DOS Batch Forum
Topic: error appending file to itself
Replies: 3
Views: 3342

error appending file to itself

Hello All! I recently noticed some unexplained behaviour when appending a file to itself using type (from the command line): <nul set /p "=###" >hashes.tmp for /l %I in (1 1 8) do type hashes.tmp >>hashes.tmp So far, so good. The file size is 768 bytes, as expected. But when I do this: typ...