Search found 215 matches

by Sponge Belly
27 Apr 2016 14:17
Forum: DOS Batch Forum
Topic: Can formfeed character be written to file
Replies: 5
Views: 6779

Re: Can formfeed character be written to file

npocmaka wrote:

Code: Select all

cls>>temp.txt


Excellent! :)
by Sponge Belly
27 Apr 2016 13:48
Forum: DOS Batch Forum
Topic: Passing batch argument to Choice command
Replies: 20
Views: 18409

Re: Passing batch argument to Choice command

Aacini wrote:

Code: Select all

set "vars=apl1=2,apl2=,apl3=kup,aplN=etc"
set "%vars:,=" & set "%"


Brilliant! 8)
by Sponge Belly
04 Apr 2016 13:17
Forum: DOS Batch Forum
Topic: Text Flow (like word wrapping to a margin) of free form text lines
Replies: 7
Views: 37970

Re: Text Flow (like word wrapping to a margin) of free form text lines

Hi John A!

Have a look at PrepMessage.cmd posted to alt.msdos.batch.nt by Frank P Westlake in January, 2013.

HTH! :)

- SB
by Sponge Belly
28 Nov 2015 08:18
Forum: DOS Batch Forum
Topic: revamped forum
Replies: 38
Views: 35075

revamped forum

Hello All! I’m just going to come right out and say it. I’m not happy with the revamped forum. I have several issues. First, I’m having difficulties loading the home page. Several attempts are usually required. I suspect the honking big Google Ads frame may have something to do with it. Next, the ‘V...
by Sponge Belly
22 Nov 2015 11:49
Forum: DOS Batch Forum
Topic: split string into substrings based on delimiter
Replies: 44
Views: 86066

Re: split string into substrings based on delimiter

Hello Again! Below is my revised code for trimming whitespace from the start and end of a string: @echo off & setlocal enableextensions disabledelayedexpansion :: nasty str full of poison chars set ^"str= ^^^" ^^^&^^ ^&^"^& %%os%% !random! ^" :: double all quotes ...
by Sponge Belly
22 Nov 2015 11:01
Forum: DOS Batch Forum
Topic: call set bug?
Replies: 8
Views: 7457

Re: call set bug?

Hi Jeb, :)

Thanks for the explanation, but I think I’ll stick with Dave Benham’s icall macro if I ever find myself in a situation where I’m forced to make extensive use of call set.

Cheers!

- SB
by Sponge Belly
22 Nov 2015 10:47
Forum: DOS Batch Forum
Topic: two findstr questions
Replies: 27
Views: 25755

Re: two findstr questions

Hi Aacini! :)

I explored a findstr /no solution, but decided it was too messy. There’s no way to tell Unix and Windows line-endings apart, line numbers must be decremented, and what if the last line in the file happens to be the longest? :?

Cheers!

- SB
by Sponge Belly
21 Nov 2015 08:55
Forum: DOS Batch Forum
Topic: two findstr questions
Replies: 27
Views: 25755

find longest line in text file

Hello Again! I returned to this problem after a long break with a fresh perspective. Sure enough, the only practical solution, imho, is a hybrid script: @if (@X==@Y) @then @echo off & setlocal enableextensions disabledelayedexpansion for /f "tokens=1,2" %%A in (' cscript //nologo //e:j...
by Sponge Belly
21 Nov 2015 04:53
Forum: DOS Batch Forum
Topic: call set bug?
Replies: 8
Views: 7457

Re: call set bug?

Hi Jeb, Ah, now I get it! The weird syntax is to guard against the unlikely event that a user has a file called "set.bat" or "set<Space>.bat" on his/her PATH. However did you think to check for that? And one last thing, you said: I reinvent the wheel this year, but this time my n...
by Sponge Belly
18 Nov 2015 14:59
Forum: DOS Batch Forum
Topic: call set bug?
Replies: 8
Views: 7457

Re: call set bug?

Hi Penpen and Jeb! Thanks for the explanations. Just one more pitfall to look out for when writing a Batch file! On a related topic, Jeb wrote in this post : set "safeSet=set^ "" call %%safeSet%% var=123" I was wondering why you didn’t just write: set "safeSet=set" call...
by Sponge Belly
17 Nov 2015 14:26
Forum: DOS Batch Forum
Topic: Iterating For The Last 60 Days
Replies: 8
Views: 6234

Re: Iterating For The Last 60 Days

Hi Samir! :)

Perhaps this post from Nov 2013 may be of interest. ;)

- SB
by Sponge Belly
14 Nov 2015 15:10
Forum: DOS Batch Forum
Topic: call set bug?
Replies: 8
Views: 7457

call set bug?

Hello All! Sorry I haven’t posted in a while. My mind has been… elsewhere. Anyways, could someone please explain what’s going on here? @echo off & setlocal enableextensions disabledelayedexpansion set ^"str= hello ^&^"^& world! ^" (call;) call set "str1=%%str%%" ...
by Sponge Belly
10 Aug 2015 13:22
Forum: DOS Batch Forum
Topic: Using Variable As For-Loop Token Value
Replies: 7
Views: 10006

Re: Using Variable As For-Loop Token Value

Hello All! Sorry I’m late to the discussion, as usual. But my solution takes advantage of the popping the CALL stack technique Siberia-Man told us about on June 7th: @echo off & setlocal enableextensions disabledelayedexpansion set ^"str=^" ^&^^ ^"^^^&^"^& !^^!^^^...
by Sponge Belly
29 Jun 2015 15:35
Forum: DOS Batch Forum
Topic: re-use %* without corrupting it?
Replies: 5
Views: 5543

Re: re-use %* without corrupting it?

Hi Guys! Sorry for the delay in replying. Here’s what I (eventually) came up with: @echo off & setlocal enableextensions disabledelayedexpansion (call;) set "crlf=%tmp%\crlf.tmp" >"%crlf%" echo( for %%A in ("%crlf%") do set "crlfSize=%%~zA" if %crlfSize% n...
by Sponge Belly
23 Jun 2015 11:43
Forum: DOS Batch Forum
Topic: Exception Handling with batch using erroneous GOTO
Replies: 16
Views: 32770

Re: Exception Handling with batch using erroneous GOTO

Hello All! :)

Fascinating topic. But could someone show me how to use this new technique to stop a for /l loop in its tracks?

TIA!

- SB