Search found 199 matches

by Sponge Belly
28 Dec 2017 10:53
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 31
Views: 15919

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

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

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

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

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

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...
by Sponge Belly
05 Sep 2017 09:22
Forum: DOS Batch Forum
Topic: Variable expansion inside :: comments?
Replies: 10
Views: 3794

Re: Variable expansion inside :: comments?

@Dave Thanks for the refresher! @Phil Something like: set "var=%var:#=$$%" could potentially double a variable in size. And if the variable is over 4095 characters to begin with, it will overflow and cause a fatal error. Is there any way to catch such errors and take remedial action? - SB
by Sponge Belly
25 Aug 2017 07:56
Forum: DOS Batch Forum
Topic: Variable expansion inside :: comments?
Replies: 10
Views: 3794

Variable expansion inside :: comments?

Hello All! I was trying to catch errors from overflowing variables (is it possible, btw?) when I noticed the following: @echo off & setlocal enableextensions disabledelayedexpansion :: create variable containing 4k hashes set "hashFile=%tmp%\hashFile.tmp" if not exist "%hashFile%&...
by Sponge Belly
06 Apr 2017 13:03
Forum: DOS Batch Forum
Topic: Can anyone explain what is happening here
Replies: 3
Views: 2294

Re: Can anyone explain what is happening here

Hello All! In 2008, a Stack Overflow user asked how to echo a newline in Batch files. Someone called Ken posted this answer . This prompted a request for an explanation of how the code worked, but Ken was unforthcoming. So Jeb took up the slack and provided this now famous answer … two and a half ye...
by Sponge Belly
01 Mar 2017 09:41
Forum: DOS Batch Forum
Topic: proof of concept: alternate asynchronous non-blocking input
Replies: 6
Views: 2475

Re: proof of concept: alternate asynchronous non-blocking input

Hi Phil,

I didn’t know you could coax a tab from robocopy like that. Thanks for the tip! :)

- SB
by Sponge Belly
15 Feb 2017 16:10
Forum: DOS Batch Forum
Topic: Multi-line menu with options selection via DOSKEY
Replies: 15
Views: 18303

Re: Multi-line menu with options selection via DOSKEY

Hello All! Here’s an alternative approach I cobbled together: @echo off & setlocal enableextensions disabledelayedexpansion (call;) title Menu Demo mode con lines=15 cols=20 (set lf=^ %= DO NOT DELETE =% ) set ^"nl=^^^%lf%%lf%^%lf%%lf%^" set ^"\n=^^^%lf%%lf%^%lf%%lf%^^" cls e...
by Sponge Belly
14 Feb 2017 13:11
Forum: DOS Batch Forum
Topic: Some undocumented things with turned off command extensions
Replies: 12
Views: 3797

Re: Some undocumented things with turned off command extensions

Hi Penpen, Thanks for explaining GOTO’s mysterious behaviour. And you don’t need the body of a FOR loop or an IF block. An unconditional parenthesized block will do. See my previous post for a simplified code example. And you’re right about the ampersand as command separator. I don’t know what I was...
by Sponge Belly
12 Feb 2017 15:23
Forum: DOS Batch Forum
Topic: Some undocumented things with turned off command extensions
Replies: 12
Views: 3797

Re: Some undocumented things with turned off command extensions

Hi Again! I noticed the GOTO glitch when playing around with the code developed in the Foolproof Counting of Arguments topic. I’ve boiled it down to this: @echo off & setlocal enableextensions disabledelayedexpansion ( goto skip :skip echo(first label ) :skip echo(second label endlocal & got...
by Sponge Belly
12 Feb 2017 11:18
Forum: DOS Batch Forum
Topic: Some undocumented things with turned off command extensions
Replies: 12
Views: 3797

Re: Some undocumented things with turned off command extensions

Hello All! Interesting discussion. I’d like to add the following observations made while extensions were disabled. The PROMPT command doesn’t work. Neither does: set "prompt=@" Otoh… set prompt=@ does work. And another thing I’ve noticed is that if there are 2 labels with the same name, GO...