Search found 199 matches

by Sponge Belly
17 Aug 2020 08:24
Forum: DOS Batch Forum
Topic: store nth line of file in variable
Replies: 10
Views: 5029

Re: store nth line of file in variable

Hi Samir! :)

To paraphrase Robbie Robertson, this is sure stirring up some ghosts for me. ;)

Two things spring to mind. What code are you using? And are the HTML files in Unicode format?

TIA!

- SB
by Sponge Belly
26 May 2020 09:53
Forum: DOS Batch Forum
Topic: Source Code for GW-Basic Released
Replies: 0
Views: 1088

Source Code for GW-Basic Released

Hello All! :)

I thought you might be interested in this post on the Windows Command Line blog:
Happy coding! :cool:

- SB
by Sponge Belly
08 Mar 2020 09:26
Forum: DOS Batch Forum
Topic: mshta command for copy into clipboard
Replies: 10
Views: 4983

Re: mshta command for copy into clipboard

Hello All! Slightly OT, perhaps, but here goes… Placing content on the clipboard is severely restricted for security reasons. But there are workarounds. This SO Answer by Srikanth P provides a JScript solution that makes expert use of the Internet Explorer object. HTH! :) - SB PS: Just spotted a typ...
by Sponge Belly
07 Aug 2019 15:27
Forum: DOS Batch Forum
Topic: String manipulation - remove leading and trailing spaces
Replies: 2
Views: 3643

Re: String manipulation - remove leading and trailing spaces

Hi Eureka! Welcome to the forum! :) Dave Benham explored this approach in the novel method to right-trim spaces topic back in January, 2012. :shock: As pointed out at the time, the method had too many shortcomings to ever be a general-purpose solution, and development ceased. But trimming leading an...
by Sponge Belly
21 Nov 2018 09:19
Forum: DOS Batch Forum
Topic: doskitXPserver2003
Replies: 2
Views: 2655

Re: doskit XP/server2003 TEASER

Hi Ed,

Doskit sounds amazing! 8)

I’d love to try it out, but I’m running Windows 7. :(

What difficulty does Doskit have with Windows 7?

- SB
by Sponge Belly
21 Nov 2018 09:12
Forum: DOS Batch Forum
Topic: Wildcard during directory lookup produces unexpected results
Replies: 7
Views: 2931

Re: Wildcard during directory lookup produces unexpected results

Hi Ed,

Is it a for /r bug? I remember reading somewhere that for /r can generate erroneous output under certain conditions. As usual, I can’t remember where I read it, sorry. :(

Maybe someone with a better memory (and a more organised bookmarks collection) can help you out. ;)

Good luck!

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

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

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

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

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: 4
Views: 3711

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

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

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: 31
Views: 15415

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