Search found 199 matches

by Sponge Belly
10 Aug 2013 15:50
Forum: DOS Batch Forum
Topic: strimmer: a string trimmer
Replies: 5
Views: 3092

Re: strimmer: a string trimmer

Thanks for the explanation, Jeb! :-)

- SB
by Sponge Belly
10 Aug 2013 13:40
Forum: DOS Batch Forum
Topic: vagaries of for /f loops
Replies: 4
Views: 1816

Re: vagaries of for /f loops

Thanks Penpen and Dave! In the second example, multiple parameter separators (, ; = <SP> and <TAB>) are indeed replaced with a single space… but not dots. Note that if you quote the string, any leading whitespace and the opening quote itself will be stripped away and the rest of the string will be d...
by Sponge Belly
07 Aug 2013 09:15
Forum: DOS Batch Forum
Topic: strimmer: a string trimmer
Replies: 5
Views: 3092

Re: strimmer: a string trimmer

Thanks Penpen…

Edit: Please read revised code.

- SB
by Sponge Belly
03 Aug 2013 16:20
Forum: DOS Batch Forum
Topic: strimmer: a string trimmer
Replies: 5
Views: 3092

strimmer: a string trimmer

Hi All! :-)

Below is an alternative technique for trimming leading and trailing spaces and tabs from a string…

Edit: Please read revised code.

- SB
by Sponge Belly
01 Aug 2013 08:22
Forum: DOS Batch Forum
Topic: vagaries of for /f loops
Replies: 4
Views: 1816

vagaries of for /f loops

Dear DosTips, I came across something puzzling while researching an alternative method of trimming whitespace (spaces and/or tabs) from the head and tail of a string. To trim any whitespace on the left of a string, simply do this: for /f "tokens=*" %%a in ("%string%") do set &quo...
by Sponge Belly
09 Jul 2013 18:40
Forum: DOS Batch Forum
Topic: how to read input from a pipe
Replies: 9
Views: 4008

Re: how to read input from a pipe

Hello Sambasiva! :-)

I recommend the find or findstr prompt issue topic. See my contribution at the end. :D

If you have any further questions, don’t hesitate to ask.

- SB
by Sponge Belly
09 Jul 2013 18:26
Forum: DOS Batch Forum
Topic: Some Explaination on these
Replies: 6
Views: 2497

Re: Some Explaination on these

Hello Flora! This line of code is a clever but ugly hack: SET v=%v:;=&rem.% It has the effect of discarding everything in the string after the first occurrence of semi-colon (inclusive). It is the opposite of: SET v=%v:*;=% which removes everything before the first occurrence of a semi-colon (se...
by Sponge Belly
09 Jul 2013 17:58
Forum: DOS Batch Forum
Topic: FTP Download only new files any file type
Replies: 7
Views: 3866

Re: FTP Download only new files any file type

Hi Again! I tinkered with your version of the FTP script and eventually got it to work: @Echo Off & setlocal enableextensions Set "FtpCommand=ls" Call:extractFileSection "[Ftp Script 1]" "-">"%temp%\%~n0.ftp" Set "FileList=" For /F "Delims=&...
by Sponge Belly
08 Jul 2013 09:13
Forum: DOS Batch Forum
Topic: batch programming help
Replies: 3
Views: 1427

Re: batch programming help

Hello VVomble! :-)

Um… what’s wrong with… ?

Code: Select all

set "hex1=02ac08"
echo(%hex1%


Or am I missing something? And why are you using set /p? What are you trying to achieve? Please explain your task in more detail.

- SB
by Sponge Belly
08 Jul 2013 09:04
Forum: DOS Batch Forum
Topic: FTP Download only new files any file type
Replies: 7
Views: 3866

Re: FTP Download only new files any file type

Hi Again!

Please post your source code. Trim comments and remove usernames and passwords. But one thing I did notice—and this is a long shot—is a missing quote before the ls command.

Good luck! ;-)

- SB
by Sponge Belly
06 Jul 2013 15:44
Forum: DOS Batch Forum
Topic: FTP Download only new files any file type
Replies: 7
Views: 3866

Re: FTP Download only new files any file type

Hi CastorTroy! FindStr regular expressions are different from wildcard patterns. Try something like this: set FindStrArgs=/x "..*\...*" The above should output only filenames containing at least one dot. If it doesn’t, let me know. If that isn’t what you need, again get back to me and we’l...
by Sponge Belly
06 Jul 2013 08:34
Forum: DOS Batch Forum
Topic: Using setver with win98 boot disk and msdos 6.22 programs ?
Replies: 4
Views: 2859

Re: Using setver with win98 boot disk and msdos 6.22 program

Hi Again! :-)

Have you tried The CD Forum? The site is devoted to bootable CDs and boasts no less than 8 subforums. Surely one of the gurus there will be able to help you. And when he/she does, please come back and let us know what pearls of wisdom were bestowed on you. ;-)

- SB
by Sponge Belly
06 Jul 2013 05:48
Forum: DOS Batch Forum
Topic: %~z1 question
Replies: 6
Views: 4182

Re: %~z1 question

@npocmaka_: Welcome to DosTips! @Squashman: You’re absolutely right, as usual. I overlooked this line: SET "z1=%~z1" Dave had said previously that one solution would be to use delayed expansion, so I made a link where there was none and confused !1z! in Endoro’s snippet with the erroneous ...
by Sponge Belly
05 Jul 2013 16:56
Forum: DOS Batch Forum
Topic: %~z1 question
Replies: 6
Views: 4182

Re: %~z1 question

@Endoro: Thanks for the revised code! It never occurred to me that parameters could be referred to as “!~z1!” using delayed expansion. I don’t remember seeing it used before. I’ve seen “!%~1!”plenty of times, but that’s a whole other box of crayons. @Dave: Thanks for the great explanation. It makes ...
by Sponge Belly
04 Jul 2013 14:13
Forum: DOS Batch Forum
Topic: Using setver with win98 boot disk and msdos 6.22 programs ?
Replies: 4
Views: 2859

Re: Using setver with win98 boot disk and msdos 6.22 program

Hi Taripo! DOS 6.22 programs should run without any problems under Windows 98, or am I missing something? If you’re trying to execute an old DOS program under XP or higher, try right-clicking on it, selecting Properties from the pop-up menu, and click on the Compatibility tab… although I doubt if th...